Marked as helpful by the asker
The form is re-rendering with key or being replaced by a new element on error, so the browser drops the uncontrolled inputs. Return the submitted values from the server action and use defaultValue={state.values.email}, or make the fields controlled. Delete the localStorage code.