This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 251
Control component model values with 'debounce' defined are not resetting on actions.reset #884
Comments
lstuartfry
changed the title
Control component values with 'debounce' defined are not resetting on actions.reset
Control component model values with 'debounce' defined are not resetting on actions.reset
Jul 17, 2017
Looks great, thanks! |
Hi guys, Unless i am missing something this issue is still happening in current version Please let me know. Thanks |
I can confirm, this is still an issue with the latest version(s) of react-redux-form. |
My current work around is to use |
davidkpiano
added a commit
that referenced
this issue
Sep 24, 2017
peterox
pushed a commit
to peterox/react-redux-form
that referenced
this issue
Oct 26, 2017
peterox
pushed a commit
to peterox/react-redux-form
that referenced
this issue
Oct 26, 2017
peterox
added a commit
to peterox/react-redux-form
that referenced
this issue
Oct 26, 2017
…avidkpiano#951 davidkpiano#884" This reverts commit dd333e5.
peterox
added a commit
to peterox/react-redux-form
that referenced
this issue
Oct 26, 2017
…t + unit tests. Fixes davidkpiano#884" This reverts commit cde1252.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The Problem
When building a Control component and defining a 'debounce' prop, that component's model value is not reset when calling actions.reset on the form model. This is most likely related to the changes released with version 1.11.2, in relation to the 'debounce' prop. It looks like this change was added in relation to issue #799. The problem is, even if the debounced actions.change action has already finished updating the form, it will run again immediately after the component is unmounted.
Steps to Reproduce
Simply mount a form with a single Control component, and define a 'debounce' prop on the component. In componentWillUnmount, call an actions.reset on the form. Enter any value in the field, and unmount the form. First, the actions.reset call occurs, followed immediately by an actions.change call that restores the model to it's previous value.
Expected Behavior
The model's value will be restored to it's original value, defined wherever you chose to write its initialFormState.
Actual Behavior
The model is first reset to it's initial value, then restored to whichever value it held when the last debounced actions.change call was made.
Reproducible Code Example
(please fork from this CodePen template)
My CodePen example implements a simple button that switches between two forms. Each form calls actions.reset on its respective model on componentWillUnmount.
Please note - when I revert to version 1.11.1 or earlier, this problem does not occur. Also, I'd be more than happy to take a look at the source code and start working on a solution that satisfies both issue #799 and this new unexpected behavior.
The text was updated successfully, but these errors were encountered: