Skip to content
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

Fields on FormGroup not updated on patchValue while having enabled/disabledWhile #61

Closed
CesarD opened this issue Nov 27, 2020 · 0 comments

Comments

@CesarD
Copy link

CesarD commented Nov 27, 2020

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

I have a few fields on a FormGroup, and some of them I set an enabledWhile function to enable/disable them based on whether other fields have certain values or not. So far so good. The problem arises when I try to use the FormGroup to edit an existing item and execute a patchValue with all the data needed to update the FormGroup, and then the issues start: the fields that don't have any conditional enabled/disabled state, work just fine, but those that have the enableWith function applied don't get their value update on the UI (despite the FormGroup.value reflecting the values correctly).
I have to execute a setTimeout(this.formData.patchValue(data)) right below the first patchValue to update these neglected fields and reflect the value on the UI.

Expected behavior

I would expect that when I perform a patchValue, that the FormGroup gets correctly updated, even for those fields that have a enabledWhile/disabledWhile method applied.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Angular version: 11.0.0


Browser:
- [X] Chrome (desktop) version 87.0.4280.66
- [ ] 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
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

@CesarD CesarD closed this as completed Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant