most visited ssr

This commit is contained in:
hamid zarghami
2025-04-16 11:16:15 +03:30
parent 3fe334d3ad
commit 9bfe3981aa
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
import { Suspense } from 'react'
import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'
import { blogSingleQueryOptions } from '../hooks/useBlogsData'
import { blogSingleQueryOptions, mostVisitedBlogsQueryOptions } from '../hooks/useBlogsData'
import { NextPage } from 'next'
import SingleBlogPage from '../components/SingleBlogPage'
import Loading from './loading'
@@ -24,6 +24,7 @@ const SingleBlog: NextPage<PageProps> = async ({ params }) => {
async function BlogContent({ id }: { id: string }) {
const queryClient = new QueryClient()
await queryClient.prefetchQuery(blogSingleQueryOptions(id))
await queryClient.prefetchQuery(mostVisitedBlogsQueryOptions)
return (
<HydrationBoundary state={dehydrate(queryClient)}>
+9
View File
@@ -0,0 +1,9 @@
import React from 'react'
const page = () => {
return (
<div>page</div>
)
}
export default page