frontend / api/suppliers/hooks/useSupplierPageQuery / useSupplierPageQuery
Function: useSupplierPageQuery()
useSupplierPageQuery(
params,enabled):UseQueryResult<SupplierListResponse,Error>
Defined in: src/api/suppliers/hooks/useSupplierPageQuery.ts:44
Hook to load paginated suppliers from the backend. Caches results for 1 minute to reduce API calls.
Parameters
params
Pagination, filtering, and sorting parameters
enabled
boolean = true
Whether to fetch (defaults to true)
Returns
UseQueryResult<SupplierListResponse,
Error>
React Query result with paginated supplier data
Enterprise
- Only fetches when enabled (performance optimization)
- 1-minute cache reduces backend load for rapid pagination
- Automatically handles loading and error states
- Type-safe pagination model for DataGrid integration
Example
const { data, isLoading, error } = useSupplierPageQuery(
{ page: 1, pageSize: 10, q: 'acme' },
true
);
return <DataGrid rows={data?.items} rowCount={data?.total} loading={isLoading} />;