Dispatching submit after initialize yields wrong form values
See original GitHub issueType
Probably a bug.
Process
- Set
onSubmit
tohandleSubmit(data => ...)
. - Dispatch an
initialize(FORM_NAME, {})
action to clearinitialValues
. - Dispatch a
reset(FORM_NAME)
action to revert to the previously initialized values. - Dispatch a
submit(FORM_NAME)
action to submit empty values.
Current behavior
- Parameter
data
is a string and equals theFORM_NAME
value.
Expected behavior
- Parameter
data
is an empty object.
Environment
redux-form@6.4.3
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
How to keep redux-form submission errors after switching from ...
When I receive the field errors from the server, I put them on redux-store using "stopSubmit" action creator (tried using setSubmitFailed too, ...
Read more >submit -> submitSuccess -> reinitialize -> form.pristine == true ...
dispatch (initialize(props.form.name, props.form.values) }. After the form ... I expect pristine to become false after form data is changed.
Read more >What is "Input dispatching timed out" and how to solve it
It means, the main thread which stacktrace you're showing here is stuck, and it didn't process the event that was being send to...
Read more >Handling Forms in Svelte - This Dot Labs
Currently, our form does nothing. We need to handle the submit event on the form. To do that, we must add a handler....
Read more >reduxForm(config:Object)
a function that takes all the form values, the dispatch function, the props given to your component and the current blurred field, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is happening to me on 7.0.3. My scenario is not in one synchronous block.
initialize
is calledinitial
is updated and so isvalues
.initial
is correct andvalues
are correct, BUT, the values sent to the handleSubmit method are still theinitial
. They never get set tovalues
. The reducer is correctly updating, but handleSubmit does not. It’s also worth mentioning that thedirty
flag is correctly reset from the initialize, but any field modifications after that do not set thedirty
flag totrue
.It’s like the react component is partially disconnected from redux-form after the initialize. By not doing an initialize, everything stays in sync (but i dont get the dirty property reset, which is ultimately what im going for)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.