Layout is re-rendered when server action is called
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
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
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
2 Replies
Giant pandaOP
Please if anyone can help with this
Giant pandaOP
@German Longhaired Pointer Been trying to get your attention on this Github issue you closed. It doen't work properly even without using the redirect. I left multiple examples in differnt branches but you didn't check them before closing the issue