-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
nz-code-editor's ControlValueAccessor triggers superfluous view→model updates #5869
Comments
FYI I couldn't provide a Stackblitz because I can't get nz-code-editor to work in there. |
Fixed by #5872. Thanks for your issue and PR! 🥂 |
@wendellhu95 My PR was a different issue, this issue is not fixed by that PR. |
I can't open a PR at the moment, but if someone wants to send the fix for this, I believe all that has to be done is change
If you want to test this, essentially we need to make sure that calling writeValue does not trigger the onChange function. |
Before notifying Angular (through the ControlValueAccessor mechanism) of a change to the value we make sure that the value has actually changed. This is necessary to avoid feedback loops as writeValue (model -> view) would otherwise cause this to be fired (view -> model) which can cause infinite loop issues on the usage side or broken validation detection. fixes NG-ZORRO#5869
Before notifying Angular (through the ControlValueAccessor mechanism) of a change to the value we make sure that the value has actually changed. This is necessary to avoid feedback loops as writeValue (model -> view) would otherwise cause this to be fired (view -> model) which can cause infinite loop issues on the usage side or broken validation detection. fixes #5869
Steps to reproduce
The ControlValueAccessor for nz-code-editor seems to have an issue where a model->view update will also trigger a view->model update, which can cause all kinds of issues like infinite loops when subscribing to form changes and then writing back into the control.
The text was updated successfully, but these errors were encountered: