Next.js Discord

Discord Forum

BUG in NextJS 14.2.1+ : useFormState hook not handling Server Action response correctly.

Unanswered
Bachman's Sparrow posted this in #help-forum
Open in Discord
Bachman's SparrowOP
I have a server action for login, which was working completely fine in Next 14.1. From past few days, an issue is occurring at successful login. The issue is that the user is not getting redirected after login.

I debugged the issue's root cause, to solve it I tried two different methods.

1. send redirect or permanentRedirect in server action response. Both do not work in nextjs v14.2.1

2. send a route/URL in response and redirect user from client side. I checked the network tab, and server action response was correct. But, useFormState hook was not providing the correct response in the state, instead it was setting state just as initial state.

0 Replies