refactoring: improvements for lighthouse
This commit is contained in:
1 parent
f2f242a684
commit
38aebcbe28
27 files changed
+132
-93
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ const Random = async () => {
|
||||
|
||||
await queryClient.prefetchInfiniteQuery({
|
||||
queryKey: ['random-movie'],
|
||||
queryFn: () => randomMovies(),
|
||||
queryFn: randomMovies,
|
||||
initialPageParam: '1'
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { popularMovies } from '@/api';
|
||||
import useInfiniteList from '@/hooks/useInfiniteList';
|
||||
|
||||
const usePopular = () => useInfiniteList({ queryKey: ['popular'], queryFn: popularMovies });
|
||||
const usePopular = () => useInfiniteList({ suspense: true, queryKey: ['popular'], queryFn: popularMovies });
|
||||
|
||||
export default usePopular;
|
||||
@@ -10,6 +10,7 @@ interface Props {
|
||||
|
||||
const useSimilar = ({ showId, showType = 'movie' }: Props) =>
|
||||
useInfiniteList({
|
||||
suspense: true,
|
||||
enabled: Boolean(showId),
|
||||
queryKey: ['similar', showId, showType],
|
||||
queryFn: ({ page }) => similarShows({ page, showId, showType })
|
||||
|
||||
@@ -5,6 +5,7 @@ import useInfiniteList from '@/hooks/useInfiniteList';
|
||||
|
||||
const useStarring = ({ actorId }: { actorId?: string }) =>
|
||||
useInfiniteList({
|
||||
suspense: true,
|
||||
queryKey: ['starring', actorId],
|
||||
enabled: Boolean(actorId),
|
||||
queryFn: ({ page }) => topMovies({ page, starring: actorId })
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { topMovies } from '@/api';
|
||||
import useInfiniteList from '@/hooks/useInfiniteList';
|
||||
|
||||
const useTop = () => useInfiniteList({ queryKey: ['top'], queryFn: topMovies });
|
||||
const useTop = () => useInfiniteList({ suspense: true, queryKey: ['top'], queryFn: topMovies });
|
||||
|
||||
export default useTop;
|
||||
Reference in new issue
Block a user