Infinite loop in walkTNodeTree with nested *ngIf
See original GitHub issueI’ve only just recently started using Angular (v7), so this might be my fault, but my experience tells me otherwise.
🐞 bug report
Affected Package
@angular/core 7.2.10
Description
<ng-container id="c1" *ngIf="b === 1"> <el *ngIf="a === 1"> <el *ngIf="a !== 1"> </ng-container>
<ng-container id="c2" *ngIf="b !== 1"> <el *ngIf="a === 1"> <el *ngIf="a !== 1"> </ng-container>
switching b
from 1 to 2 while ‘a === 1’ causes infinite loop in walkTNodeTree
(core/fesm2015/core.js:4777
) and from the looks of it, it happens because upon walking “past” the first element in #c1, currentView[NEXT]
is always null (since neither currentView
nor NEXT
change) and tnode.next
is null because of the other condition (a
).
However, if I move <el>
outside of <ng-container>
and replace their conditions with b === 1 && ...
then everything works.
🔬 Minimal Reproduction
Couldn’t reproduce it on StackBlitz, so here is the whole repo of the project I’m working on:
https://github.com/mrnateriver/angular-temporary-repo
(sorry that it’s in russian, but you can just do ng serve
, navigate to /login
and click the yellow button on the right (“Далее”)).
The component in question is src/app/features/auth/login-form
, and it is embedded in login-page
.
🌍 Your Environment
Angular CLI: 7.3.6
Node: 10.15.3
OS: win32 x64
Angular: 7.2.10
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.13.6
@angular-devkit/build-angular 0.13.6
@angular-devkit/build-optimizer 0.13.6
@angular-devkit/build-webpack 0.13.6
@angular-devkit/core 7.3.6
@angular-devkit/schematics 7.3.6
@angular/cdk 7.3.5
@angular/cli 7.3.6
@angular/material 7.3.5
@ngtools/webpack 7.3.6
@schematics/angular 7.3.6
@schematics/update 0.13.6
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
Tested in Chrome 73.0.3683.86 and Firefox 66.0.2.
P.S.
Even if it’s not a bug but rather I’ve done something wrong, I still think that loop shouldn’t be infinite in any case.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
I tried your example and confirmed the issue. Then I tried it with the latest beta and everything seems to work fine. Here is the list of dependencies if you want to try:
I’ll close it since it works now, let me know if you still have an issue.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.