fix: back to prefetch
This commit is contained in:
1 parent
a268f7c38d
commit
c9ca262da8
14 files changed
+180
-27
No files matched your search
@@ -1,5 +1,32 @@
|
||||
import { FC } from 'react';
|
||||
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
||||
|
||||
import popularQuery from '@/data/queries/popular';
|
||||
import getQueryClient from '@/lib/queryClient';
|
||||
|
||||
import Container from './container';
|
||||
|
||||
const Starring = () => <Container />;
|
||||
interface Props {
|
||||
searchParams: Record<string, string>;
|
||||
}
|
||||
|
||||
const Starring: FC<Props> = ({ searchParams }) => {
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
const { actorId } = searchParams || {};
|
||||
|
||||
queryClient.prefetchInfiniteQuery(
|
||||
popularQuery({
|
||||
sortBy: 'vote_average.desc',
|
||||
starring: actorId
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<Container />
|
||||
</HydrationBoundary>
|
||||
);
|
||||
};
|
||||
|
||||
export default Starring;
|
||||
Reference in new issue
Block a user