feat: proxy cache
This commit is contained in:
1 parent
32e7885791
commit
995342f18a
9 files changed
+17
-28
No files matched your search
@@ -1,18 +1,15 @@
|
||||
import { useMemo } from 'react';
|
||||
import { QueryKey, useInfiniteQuery } from '@tanstack/react-query';
|
||||
import { QueryKey, useInfiniteQuery, useSuspenseInfiniteQuery } from '@tanstack/react-query';
|
||||
|
||||
interface Props {
|
||||
suspense?: boolean;
|
||||
queryKey: QueryKey;
|
||||
enabled?: boolean;
|
||||
queryFn: ({ pageParam }: { pageParam: string }) => Promise<Pagination<Show>>;
|
||||
initialPageParam?: string;
|
||||
getNextPageParam?: () => string | undefined;
|
||||
}
|
||||
|
||||
const useInfiniteList = ({ queryKey, queryFn, enabled, initialPageParam, getNextPageParam }: Props) => {
|
||||
const { data, hasNextPage, fetchNextPage, isFetched, isLoading } = useInfiniteQuery({
|
||||
enabled,
|
||||
const useInfiniteList = ({ queryKey, queryFn, initialPageParam, getNextPageParam }: Props) => {
|
||||
const { data, hasNextPage, fetchNextPage, isFetched, isLoading } = useSuspenseInfiniteQuery({
|
||||
queryKey,
|
||||
queryFn: ({ pageParam }) => queryFn({ pageParam }),
|
||||
getNextPageParam:
|
||||
|
||||
Reference in new issue
Block a user