mirror of
https://github.com/docmost/docmost.git
synced 2026-07-24 22:02:51 +10:00
WIP
This commit is contained in:
@@ -33,10 +33,19 @@ export function useBaseRowsQuery(
|
||||
filters?: ViewFilterConfig[],
|
||||
sorts?: ViewSortConfig[],
|
||||
) {
|
||||
// Normalize empty arrays to undefined so query keys stay stable
|
||||
const activeFilters = filters?.length ? filters : undefined;
|
||||
const activeSorts = sorts?.length ? sorts : undefined;
|
||||
|
||||
return useInfiniteQuery({
|
||||
queryKey: ["base-rows", baseId, filters, sorts],
|
||||
queryKey: ["base-rows", baseId, activeFilters, activeSorts],
|
||||
queryFn: ({ pageParam }) =>
|
||||
listRows(baseId!, { cursor: pageParam, limit: 100, filters, sorts }),
|
||||
listRows(baseId!, {
|
||||
cursor: pageParam,
|
||||
limit: 100,
|
||||
filters: activeFilters,
|
||||
sorts: activeSorts,
|
||||
}),
|
||||
enabled: !!baseId,
|
||||
initialPageParam: undefined as string | undefined,
|
||||
getNextPageParam: (lastPage: IPagination<IBaseRow>) =>
|
||||
|
||||
Reference in New Issue
Block a user