-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimearea: zonesIssues related to zone.jsIssues related to zone.jscore: change detectionstate: confirmedstate: has PR
Milestone
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/coreIs this a regression?
NoDescription
Issue happens in zone-less environment when routing is used. If you remove <router-outlet></router-outlet> from app component template and put <app-counter></app-counter>, everything works fine.
Problem makes ɵmarkDirty(this) that is called immediately in ngOnInit method of counter component (see bellow Workaround 1). Then, when you click on increment or decrement button, rootContext.flags is equal to 1 (DetectChanges) instead of 0 (Empty), and because of that, tick is never scheduled:
🔬 Minimal Reproduction
- Clone https://github.com/markostanimirovic/zoneless-routing-bug repo
- Run
npm install - Run
npm start - Click on increment/decrement buttons, observe that count value is not changed
- Navigate to Counter 2, observe that count paragraph disappeared
- Navigate back to Counter, observe that count paragraph disappeared too
Workaround 1
- Open
counter.component.tsfile - Comment out lines 24-29
- Uncomment lines 32-38
Workaround 2
- Open
app.component.tsfile - Swap
ɵmarkDirty(this)withɵdetectChanges(this)on line 21
🌍 Your Environment
Angular Version: 10.1.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimearea: zonesIssues related to zone.jsIssues related to zone.jscore: change detectionstate: confirmedstate: has PR

