most visited ssr
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { Suspense } from 'react'
|
import { Suspense } from 'react'
|
||||||
import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'
|
import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'
|
||||||
import { blogSingleQueryOptions } from '../hooks/useBlogsData'
|
import { blogSingleQueryOptions, mostVisitedBlogsQueryOptions } from '../hooks/useBlogsData'
|
||||||
import { NextPage } from 'next'
|
import { NextPage } from 'next'
|
||||||
import SingleBlogPage from '../components/SingleBlogPage'
|
import SingleBlogPage from '../components/SingleBlogPage'
|
||||||
import Loading from './loading'
|
import Loading from './loading'
|
||||||
@@ -24,6 +24,7 @@ const SingleBlog: NextPage<PageProps> = async ({ params }) => {
|
|||||||
async function BlogContent({ id }: { id: string }) {
|
async function BlogContent({ id }: { id: string }) {
|
||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
await queryClient.prefetchQuery(blogSingleQueryOptions(id))
|
await queryClient.prefetchQuery(blogSingleQueryOptions(id))
|
||||||
|
await queryClient.prefetchQuery(mostVisitedBlogsQueryOptions)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
const page = () => {
|
||||||
|
return (
|
||||||
|
<div>page</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default page
|
||||||
Reference in New Issue
Block a user