App router question about Link
So, I have two pages. Page A has a <Link href="/b" />, Page B has a Math.random() called during the RSC run through. Page B also has a link back to page A. If I keep navigating between these pages, the Math.random is only ever called once. This is due to the soft navigation in next. How do I prevent or turn this off for a page? export const revalidate = 0 does nothing. I know I could manually do a router.replace then router.refresh, but that's very hacky obviously
4 Replies
Try using the
dynamic
export instead https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicFile Conventions: Route Segment Config
Learn about how to configure options for Next.js route segments.
I think
force-dynamic
should get the job done@yashsingh1 it didn't help
o shoot mb
so u want to force hard navigation
there r two ways to do that, either you can add a dynamic param that is random or you can use server actions and run
revalidatePath
not sure if there is a better way tho
or i guess you can use the a
tag