4

SSR does work ONLY when u manually/hard refresh the page and not when u navigating back and forward with Link component from next/link...(with Link component - entering the (page / path / segment) first time will SSR, but reentering the same page/path SSR doesnt work anymore) This hurts me so much. How do we solve this?

PS. To activate the SSR I have tested all variants.

On segment (layout / page) level:

  1. export const dynamic = 'force-dynamic'
  2. export const revalidate = 0
  3. export const fetchCache = 'force-no-store'

on .fetch() options level:

  1. {cache: 'no-store'}
  2. {next: {revalidate: 0}}
  3. { cache: 'no-store', next: {revalidate: 0} }

So whats the problem? SSR should fetch against DB EACH time path changes to render the page with new content. Or am i wrong?

1 Answers1

0

I think the problem is related to client-side Hydration, to fix the issue you can try the prefetch prop in the Link component:

<Link href="/about" prefetch>
   About
</Link>
dom1
  • 425
  • 1
  • 2
  • 19