-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submitting
not getting reset after submit
#487
Comments
michaltk
added a commit
to michaltk/react-final-form
that referenced
this issue
May 26, 2019
fixes final-form#487 Previously, when it was checking in the subscribe func if state updated https://github.com/final-form/react-final-form/blob/4ca1ce7a7800c08b249219e14740ec2c1ed7e222/src/ReactFinalForm.js#L89 - the current state `state` - was always the initial state, bec of js closures. So, the `submitting` got set to `true` bec that was diff than the initial state but when attempting to set back to false.. it was checking original state of `false` with current state of `false` and it was equal and therefore did not update and reset state. Changed to add `state` to the `useEffect` deps so it will rerun the effect, causing it to create a new subscribe func with the updated state.
erikras
pushed a commit
that referenced
this issue
May 27, 2019
fixes #487 Previously, when it was checking in the subscribe func if state updated https://github.com/final-form/react-final-form/blob/4ca1ce7a7800c08b249219e14740ec2c1ed7e222/src/ReactFinalForm.js#L89 - the current state `state` - was always the initial state, bec of js closures. So, the `submitting` got set to `true` bec that was diff than the initial state but when attempting to set back to false.. it was checking original state of `false` with current state of `false` and it was equal and therefore did not update and reset state. Changed to add `state` to the `useEffect` deps so it will rerun the effect, causing it to create a new subscribe func with the updated state.
Merged
Published fix in |
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What is the current behavior?
When subscribed to
submitting
state,submitting
never gets updated back tofalse
even after submitting.This seems to work fine in v4 and only is an issue in v5.
What is the expected behavior?
After submit,
submitting
state should befalse
again.Sandbox Link
See Demo
What's your environment?
React Final Form - 5.1.0
Final Form - 4.13.0
The text was updated successfully, but these errors were encountered: