Next.js Discord

Discord Forum

Nextjs.15 hot reloads entire form on submit

Unanswered
Whiteleg shrimp posted this in #help-forum
Open in Discord
Whiteleg shrimpOP
Hello, i noticed my form is getting completely cleared when using:

const [state, action] = useActionState(doSomething, null);


 return (
        <div>
            <form action={action}>
                <input type="text" name="test"/>
                <Button type="submit">Submit</Button>
            </form>
        </div>
    );


in nextjs 14 the data i typed inside the input would have stayed in the input

but in nextjs 15 i notice in the console [Fast Refresh] rebuilding and the whole page is rebuild when using form action, causing it to clear existing data from the form

8 Replies

Whiteleg shrimpOP
for now i downgraded back to 14, it works again as expected. if some 1 knows a fix let me know. couldn't find anything on google
well if I am not wrong, it's an expected behavior in Next.js 15 - form works as a standard html form.
https://discord.com/channels/752553802359505017/752647196419031042/1298121445880107059
check out his solution
Asian black bear
It’s not a bug in Next but a breaking change in R19, yeah.
Thanks for linking to my post!
@Whiteleg shrimp resolved?
Whiteleg shrimpOP
@James4u Thanks for linking that post. It was indeed the same problem I was facing. Since I only had 4 forms, downgrading was just as easy as upgrading. I think I'll wait until React 19 is officially released before adding workarounds and such. Thanks for the help! 🙂
Yeah, I would recommend v14 for your ongoing projects
close the thread if you dont have any other questions