Skip to content

Commit

Permalink
test: comment-out parallel grantee-list hydration boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshift committed Feb 20, 2025
1 parent 149471e commit beb0964
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions src/app/impact/[grantId]/@list/page.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
// import { dehydrate, HydrationBoundary } from '@tanstack/react-query';

import { getQueryClient } from '@/shared/utils/get-query-client';
// import { getQueryClient } from '@/shared/utils/get-query-client';

import { grantQueryKeys } from '@/grants/core/query-keys';
import { getGranteeDetails } from '@/grants/data/get-grantee-details';
import { getGranteeList } from '@/grants/data/get-grantee-list';
// import { grantQueryKeys } from '@/grants/core/query-keys';
// import { getGranteeDetails } from '@/grants/data/get-grantee-details';
// import { getGranteeList } from '@/grants/data/get-grantee-list';
import { GranteeList } from '@/grants/components/grantee-list';

interface Props {
params: Promise<{ grantId: string }>;
}
// interface Props {
// params: Promise<{ grantId: string }>;
// }

const ParallelGranteeList = async ({ params }: Props) => {
const { grantId } = await params;
const queryClient = getQueryClient();
const ParallelGranteeList = async () => {
// const ParallelGranteeList = async ({ params }: Props) => {
// const { grantId } = await params;
// const queryClient = getQueryClient();

const granteeListResult = await queryClient.fetchInfiniteQuery({
queryKey: grantQueryKeys.grantees(grantId, ''),
queryFn: async ({ pageParam: page }) => getGranteeList({ page, grantId }),
initialPageParam: 1,
});
// const granteeListResult = await queryClient.fetchInfiniteQuery({
// queryKey: grantQueryKeys.grantees(grantId, ''),
// queryFn: async ({ pageParam: page }) => getGranteeList({ page, grantId }),
// initialPageParam: 1,
// });

// Prefetch data for first item only (default for the page enough for seo)
const grantee = granteeListResult.pages.flatMap((page) => page.data).at(0);
// // Prefetch data for first item only (default for the page enough for seo)
// const grantee = granteeListResult.pages.flatMap((page) => page.data).at(0);

if (grantee) {
await queryClient.prefetchQuery({
queryKey: grantQueryKeys.grantee(grantId, grantee.slug),
queryFn: () => getGranteeDetails(grantId, grantee.slug),
});
}
// if (grantee) {
// await queryClient.prefetchQuery({
// queryKey: grantQueryKeys.grantee(grantId, grantee.slug),
// queryFn: () => getGranteeDetails(grantId, grantee.slug),
// });
// }

return (
<HydrationBoundary state={dehydrate(queryClient)}>
<GranteeList />
</HydrationBoundary>
// <HydrationBoundary state={dehydrate(queryClient)}>
<GranteeList />
// </HydrationBoundary>
);
};

Expand Down

0 comments on commit beb0964

Please sign in to comment.