Next.js Discord

Discord Forum

Does a Server Action always invalidate the Router Cache?

Unanswered
Yongho Lee posted this in #help-forum
Open in Discord
I already uploaded this topic on [Github discussion](https://github.com/vercel/next.js/discussions/78029), but I can't get a proper answer and post it here.

I know that Layouts are cached and reused on navigation. However in some situations, Layout cannot be persisted across routes and doesn't maintain state.

I made an example: https://reproduction-bug-weird-layout.vercel.app
https://github.com/yongholeeme/reproduction-bug-weird-layout

On general navigations, layout is cached and doens't rerendered. However in or after server action on navigation, layout isn't cached and rerendered although the server action doesn't do anything.

example video: https://github.com/user-attachments/assets/b95360d6-75ae-4f09-afa7-d2bff29b73fa


I'm not sure if this is normal behavior or a bug. If it's the expected behavior, it would be helpful to know where in the official documentation I can find more information.

0 Replies