const {
data,
hasNextPage,
fetchNextPage,
isFetching,
status,
refetch,
} = useInfiniteQuery({
queryKey: ["get_orders"],
queryFn: ({ pageParam = 1 }) =>
callBackend(ENDPOINT, { method: "GET" }),
staleTime: 0,
getNextPageParam: (d, _) => {
const { current_page, total_pages } = d;
d.nextCursor;
// POSSIBLE FIX FOR CACHE NOT BEING SET
cache.setQueryData(["get_orders"], d);
return current_page < total_pages ? current_page + 1 : undefined;
},
getPreviousPageParam: (d, _) => d.prevCursor,
});
const {
data,
hasNextPage,
fetchNextPage,
isFetching,
status,
refetch,
} = useInfiniteQuery({
queryKey: ["get_orders"],
queryFn: ({ pageParam = 1 }) =>
callBackend(ENDPOINT, { method: "GET" }),
staleTime: 0,
getNextPageParam: (d, _) => {
const { current_page, total_pages } = d;
d.nextCursor;
// POSSIBLE FIX FOR CACHE NOT BEING SET
cache.setQueryData(["get_orders"], d);
return current_page < total_pages ? current_page + 1 : undefined;
},
getPreviousPageParam: (d, _) => d.prevCursor,
});