-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Mon Apr 24 2023 16:37:30 GMT+0200 (heure d’été d’Europe centrale)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.19
pnpm: 8.2.0
Relevant packages:
next: 13.3.2-canary.2
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue
https://stackblitz.com/github/Fredkiss3/next-dynamic-test-updated?file=app%2Flayout.tsx
To Reproduce
- Click on the link above
- Go to
/dynamic(either by clicking on the link or by clicking on the button) - You will see on the console the current time
- Try navigating to another page, then navigate again to
/dynamic, this time you won't see anything printed on the console - If you wait 30+ seconds, and navigate again to
/dynamicyou will see the current time logged in the terminal
Describe the Bug
There were some improvements about route segment caching on client navigations introduced by this PR #48383 , but with that now <Link prefetch={false}> is not respected anymore even though it is said that a link without prefetching should not be cached at all and always refetched between navigations, this is a bug because there are some cases where we want always fresh data like auth gated routes with JWT sessions limited in time, and more.
Expected Behavior
When using a Link with prefetch={false} the page should not be cached at all and all subsequent navigations should refetch and call the server.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response