feat: proxy cache

This commit is contained in:
ner committed 2024-11-03 17:42:40 +02:00
1 parent 32e7885791
commit 995342f18a
9 files changed
+17 -28

No files matched your search

+1 -3
View File
@@ -5,7 +5,6 @@ import { atom, getDefaultStore, useAtom } from 'jotai';
import randomQuery from '@/data/queries/random';
import useInfiniteList from '@/hooks/useInfiniteList';
import useMounted from '@/hooks/useMounted';
const indexAtom = atom(0);
@@ -16,10 +15,9 @@ interface Props {
}
const useRandomMovie = ({ page }: Props) => {
const isMounted = useMounted();
const [index, setIndex] = useAtom(indexAtom);
const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery({ page, suspense: false }));
const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery({ page }));
if (movies.length && !movies[index]) {
setIndex(0);