#Layout is re-rendered when server action is called

3 messages · Page 1 of 1 (latest)

gleaming rampart
#

I created an issue already on Github https://github.com/vercel/next.js/issues/66961 but thought ask here too

when I do a router.push() after a server action is called, it causes the layout to be re-rendered. if I replace the server action call with a regular api call, this does not cause the layout to re-render

here's a video showing exactly what's going on https://github.com/festusyuma/next-issue-test
here's a sample repo with different branches for the different use cases

  • main => uses useFormState with server action (re-renders layout)
  • react-hook-form => calls server action in submit handler (re-renders layout)
  • react-hook-form-api => calls external api in submit handler (works as expected)

Thanks

GitHub

Link to the code that reproduces this issue https://github.com/festusyuma/next-issue-test To Reproduce start application in dev mode navigate to url click on the next buttom log on layout will be p...

GitHub

Contribute to festusyuma/next-issue-test development by creating an account on GitHub.

marsh sparrowBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

gleaming rampart
#

Please if anyone can help with this