fix: back to prefetch
This commit is contained in:
1 parent
a268f7c38d
commit
c9ca262da8
14 files changed
+180
-27
No files matched your search
@@ -10,10 +10,14 @@ const indexAtom = atom(0);
|
||||
|
||||
export const useSilentIndex = () => getDefaultStore().get(indexAtom);
|
||||
|
||||
const useRandomMovie = () => {
|
||||
interface Props {
|
||||
page: number;
|
||||
}
|
||||
|
||||
const useRandomMovie = ({ page }: Props) => {
|
||||
const [index, setIndex] = useAtom(indexAtom);
|
||||
|
||||
const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery());
|
||||
const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery({ page }));
|
||||
|
||||
if (movies.length && !movies[index]) {
|
||||
setIndex(0);
|
||||
|
||||
Reference in new issue
Block a user