You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ResetForm action completes before the side effects from it (ie resetting the form value) is done.
More background: We had a bug where we were calling reset form, and then waiting on that to finish (ostensibly) before setting some other values to our state. Unfortunately, unless we included delay(1) we were having those other values overwritten by the initial call to ResetForm.
Our suggested fix is to make sure that the reset form action only completes AFTER all the value changes are finished happening, rather than before.
This includes a broken version (example 1) and a fixed-with-the-workaround version (example 2). The "set form to (x, y)" is the broken button here.
Environment
Libs:
- @angular/core version: 17.0.7
- @ngxs/store version: 3.8.2
Browser:
I suspect all browsers! I have only tried on chrome desktop though.
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
The text was updated successfully, but these errors were encountered:
Affected Package
The issue is caused by package @ngxs/forms-plugin
Is this a regression?
No (not that i know of)
Description
The ResetForm action completes before the side effects from it (ie resetting the form value) is done.
More background: We had a bug where we were calling reset form, and then waiting on that to finish (ostensibly) before setting some other values to our state. Unfortunately, unless we included
delay(1)
we were having those other values overwritten by the initial call to ResetForm.Our suggested fix is to make sure that the reset form action only completes AFTER all the value changes are finished happening, rather than before.
🔬 Minimal Reproduction
https://stackblitz.com/edit/ngxs-forms-bug?file=src%2Fapp%2Fapp.component.ts
This includes a broken version (example 1) and a fixed-with-the-workaround version (example 2). The "set form to (x, y)" is the broken button here.
Environment
The text was updated successfully, but these errors were encountered: