Open Josehower opened 1 year ago
This seems the PR that is most related to this issue https://github.com/vercel/next.js/pull/49582
cc @feedthejim, @shuding
I guess one path forward would be revalidatePath('/')
(as you mentioned in your code comment in /app/create-cookie/page.tsx
), but from the discussion at the issue below, it seems revalidatePath('/')
from a Server Action is not yet working:
Yeah it doesn't work :( I've tried a bunch of techniques now. In this app, https://next-js-react-ct9wkgsaq-icyjoseph.vercel.app/pokemon/capture
collection
, you should see the pokemon you interacted withThe collection page uses force-dynamic
and cookies()
yet it stays cached by the client side.
The build printout has:
├ λ /collection 6.12 kB 98.1 kB
That means it is rendered on demand. Which means that refreshing the page works, but not doing SPA (soft) transitions.
For reference, here's the app in pages dir: https://next-js-react-gbg.vercel.app/pokemon/capture and it works as expected through the power of GSSP.
Btw, this used to work, for a brief time IIRC https://github.com/vercel/next.js/issues/43148
Experiencing identical issues and looking/waiting for a solution.
P.S.: Some new fixes on similar issues seem to have been merged to canary, but we'll have to wait for a release to test them in our project. Good to see some progress.
For me, switching to server actions fixed the issue, but it feels like it shouldn't have to be required? This is sort of an, opt-in-to GSSP like behavior, which, yes is blocking, but we can use the loading fallback for that...
Verify canary release
Provide environment information
Which 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://codesandbox.io/p/sandbox/friendly-field-ssqzdp?file=%2Fapp%2Fpage.tsx%3A10%2C1
To Reproduce
/create-cookie
create cookie
button/
Describe the Bug
The client cache is not being fully invalidated for the paths that depend on
cookies().get()
but only the page that call thecookies.().set()
method.It seems that soft navigation is still enabled after the cookie mutation.
Expected Behavior
updating a cookie should revalidate all the paths that depend on cookies().get()
or at very least perform a full cache revalidation similar as a
router.refresh()`Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-1275