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

fix(module:code-editor): only emit update if value changed #5933

Merged
merged 1 commit into from
Oct 16, 2020

Conversation

Airblader
Copy link
Collaborator

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

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #5869

Does this PR introduce a breaking change?

[ ] Yes
[X] No

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
@codecov
Copy link

codecov bot commented Oct 16, 2020

Codecov Report

Merging #5933 into master will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5933      +/-   ##
==========================================
- Coverage   90.02%   90.02%   -0.01%     
==========================================
  Files         463      463              
  Lines       13947    13949       +2     
  Branches     2202     2203       +1     
==========================================
+ Hits        12556    12557       +1     
- Misses        856      857       +1     
  Partials      535      535              
Impacted Files Coverage Δ
components/code-editor/code-editor.component.ts 13.72% <50.00%> (+0.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c901a0...5b48f96. Read the comment docs.

Copy link
Member

@wzhudev wzhudev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vthinkxie vthinkxie merged commit d8c9b4d into NG-ZORRO:master Oct 16, 2020
@github-actions
Copy link

github-actions bot commented Oct 16, 2020

😭 Deploy PR Preview d8c9b4d failed. Build logs

🤖 By surge-preview

@Airblader Airblader deleted the issue-5869 branch October 16, 2020 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nz-code-editor's ControlValueAccessor triggers superfluous view→model updates
3 participants