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): run value changes in Angular zone #5872

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

Airblader
Copy link
Collaborator

Since monaco is initialized outside the Angular zone, the onDidChangeContent
method will inherit this and therefore no change detection ends up being
triggered. This can cause e.g. validation tips to be shown with a delay
(only once another change detection cycle comes along).

Therefore we run the callback explicitly inside the Angular zone.

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:

@Airblader Airblader requested a review from wzhudev as a code owner October 6, 2020 14:40
@zorro-bot
Copy link

zorro-bot bot commented Oct 6, 2020

This preview will be available after the AzureCI is passed.

@Airblader
Copy link
Collaborator Author

CC @hsuanxyz @simplejason We came across this in our product.

@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

Merging #5872 into master will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5872      +/-   ##
==========================================
- Coverage   90.03%   90.01%   -0.03%     
==========================================
  Files         463      463              
  Lines       13920    13921       +1     
  Branches     2201     2201              
==========================================
- Hits        12533    12531       -2     
- Misses        853      855       +2     
- Partials      534      535       +1     
Impacted Files Coverage Δ
components/code-editor/code-editor.component.ts 13.00% <0.00%> (-0.14%) ⬇️
components/core/util/text-measure.ts 89.56% <0.00%> (-1.74%) ⬇️

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 1b5a77e...17c0613. Read the comment docs.

@wzhudev
Copy link
Member

wzhudev commented Oct 7, 2020

@hsuanxyz Please check schematic testing. @angular/cdk updated yesterday and seemed introducing a breaking change.

@hsuanxyz
Copy link
Member

hsuanxyz commented Oct 7, 2020

@wendellhu95 I'm in the hospital, check it later today, it may be caused by the CDK version

Since monaco is initialized outside the Angular zone, the onDidChangeContent
method will inherit this and therefore no change detection ends up being
triggered. This can cause e.g. validation tips to be shown with a delay
(only once another change detection cycle comes along).

Therefore we run the callback explicitly inside the Angular zone.
@hsuanxyz hsuanxyz force-pushed the nz-code-editor-zone-issue branch from ac7ce50 to 17c0613 Compare October 7, 2020 16:22
@wzhudev wzhudev merged commit 3bbed21 into NG-ZORRO:master Oct 8, 2020
@github-actions
Copy link

github-actions bot commented Oct 8, 2020

😭 Deploy PR Preview 3bbed21 failed. Build logs

🤖 By surge-preview

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.

3 participants