mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-17 00:44:23 +02:00
optimize ND/JF list fetch
- no longer requires 2 separate fetches for count and data - the list count includes the first page so we set the query data directly
This commit is contained in:
@@ -31,7 +31,7 @@ export const AlbumArtistListInfiniteGrid = ({
|
||||
size,
|
||||
}: AlbumArtistListInfiniteGridProps) => {
|
||||
const listCountQuery = artistsQueries.albumArtistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const AlbumArtistListInfiniteTable = ({
|
||||
size = 'default',
|
||||
}: AlbumArtistListInfiniteTableProps) => {
|
||||
const listCountQuery = artistsQueries.albumArtistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ export const AlbumArtistListPaginatedGrid = ({
|
||||
serverId,
|
||||
size,
|
||||
}: AlbumArtistListPaginatedGridProps) => {
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const listCountQuery = artistsQueries.albumArtistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
const listQueryFn = api.controller.getAlbumArtistList;
|
||||
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const { data, pageCount, totalItemCount } = useItemListPaginatedLoader({
|
||||
currentPage,
|
||||
eventKey: ItemListKey.ALBUM_ARTIST,
|
||||
|
||||
@@ -39,15 +39,15 @@ export const AlbumArtistListPaginatedTable = ({
|
||||
serverId,
|
||||
size = 'default',
|
||||
}: AlbumArtistListPaginatedTableProps) => {
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const listCountQuery = artistsQueries.albumArtistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
const listQueryFn = api.controller.getAlbumArtistList;
|
||||
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const { data, pageCount, totalItemCount } = useItemListPaginatedLoader({
|
||||
currentPage,
|
||||
eventKey: ItemListKey.ALBUM_ARTIST,
|
||||
|
||||
@@ -30,7 +30,7 @@ export const ArtistListInfiniteGrid = ({
|
||||
size,
|
||||
}: ArtistListInfiniteGridProps) => {
|
||||
const listCountQuery = artistsQueries.artistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export const ArtistListInfiniteTable = ({
|
||||
size = 'default',
|
||||
}: ArtistListInfiniteTableProps) => {
|
||||
const listCountQuery = artistsQueries.artistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@ export const ArtistListPaginatedGrid = ({
|
||||
serverId,
|
||||
size,
|
||||
}: ArtistListPaginatedGridProps) => {
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const listCountQuery = artistsQueries.artistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
const listQueryFn = api.controller.getArtistList;
|
||||
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const { data, pageCount, totalItemCount } = useItemListPaginatedLoader({
|
||||
currentPage,
|
||||
eventKey: ItemListKey.ARTIST,
|
||||
|
||||
@@ -38,15 +38,15 @@ export const ArtistListPaginatedTable = ({
|
||||
serverId,
|
||||
size = 'default',
|
||||
}: ArtistListPaginatedTableProps) => {
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const listCountQuery = artistsQueries.artistListCount({
|
||||
query: { ...query },
|
||||
query: { ...query, limit: itemsPerPage },
|
||||
serverId: serverId,
|
||||
}) as UseSuspenseQueryOptions<number, Error, number, readonly unknown[]>;
|
||||
|
||||
const listQueryFn = api.controller.getArtistList;
|
||||
|
||||
const { currentPage, onChange } = useItemListPagination();
|
||||
|
||||
const { data, pageCount, totalItemCount } = useItemListPaginatedLoader({
|
||||
currentPage,
|
||||
eventKey: ItemListKey.ARTIST,
|
||||
|
||||
Reference in New Issue
Block a user