|
|
@ -29,7 +29,8 @@ export function usePaginationQuery<
|
|
|
|
TQueryKey extends QueryKey = QueryKey
|
|
|
|
TQueryKey extends QueryKey = QueryKey
|
|
|
|
>(
|
|
|
|
>(
|
|
|
|
queryKey: TQueryKey,
|
|
|
|
queryKey: TQueryKey,
|
|
|
|
queryFn: RangeQuery<TObject>
|
|
|
|
queryFn: RangeQuery<TObject>,
|
|
|
|
|
|
|
|
cacheIndividual = false
|
|
|
|
): UsePaginationQueryResult<TObject> {
|
|
|
|
): UsePaginationQueryResult<TObject> {
|
|
|
|
const client = useQueryClient();
|
|
|
|
const client = useQueryClient();
|
|
|
|
|
|
|
|
|
|
|
@ -49,12 +50,14 @@ export function usePaginationQuery<
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
onSuccess: ({ data }) => {
|
|
|
|
onSuccess: ({ data }) => {
|
|
|
|
data.forEach((item) => {
|
|
|
|
if (cacheIndividual) {
|
|
|
|
const id = GetItemId(item);
|
|
|
|
data.forEach((item) => {
|
|
|
|
if (id) {
|
|
|
|
const id = GetItemId(item);
|
|
|
|
client.setQueryData([...queryKey, id], item);
|
|
|
|
if (id) {
|
|
|
|
}
|
|
|
|
client.setQueryData([...queryKey, id], item);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|