feat: proxy cache
This commit is contained in:
1 parent
32e7885791
commit
995342f18a
9 files changed
+17
-28
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user