refactor: change page size parameter to -1 for fetching all documents in useDocuments hook

This commit is contained in:
Anish Sarkar 2026-02-04 23:19:45 +05:30
parent c706b5f417
commit d5fd4c2863

View file

@ -6,8 +6,6 @@ import { documentsApiService } from "@/lib/apis/documents-api.service";
import type { SyncHandle } from "@/lib/electric/client";
import { useElectricClient } from "@/lib/electric/context";
const PAGE_SIZE = 100;
// Stable empty array to prevent infinite re-renders when no typeFilter is provided
const EMPTY_TYPE_FILTER: DocumentTypeEnum[] = [];
@ -165,7 +163,7 @@ export function useDocuments(
queryParams: {
search_space_id: spaceId,
page: 0,
page_size: PAGE_SIZE,
page_size: -1, // Fetch all documents
...(currentTypeFilter.length > 0 && { document_types: currentTypeFilter }),
},
});