79288454

Date: 2024-12-17 15:34:56
Score: 1
Natty:
Report link

This is a bug with the latest version of React 19. There is an issue raised here: https://github.com/facebook/react/issues/31695

I have a workaround, which is to add a onSubmit handler to the form, prevent the default behaviour, and manually call the action inside a useTransaction.

    const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
        e.preventDefault();
        const formData = new FormData(formRef.current || undefined);

        startTransition(() => {
            formAction(formData);
        });
    };
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user28807939