angular: bug(animations): Cannot read property insertNode of undefined
I’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Sorry my english is not good but I try my best to describe the problem.
Animation bug when views are removed/inserted quickly
Expected behavior
No error occur.
Minimal reproduction of the problem with instructions
https://github.com/sandangel/angular-bug.git
yarn yarn start
UPDATED: link stackblitz
https://stackblitz.com/edit/angular-dso7hm
Updated: Reproduce steps
1/ Click on table link, then then graph link will show up.
2/ Click on the ‘Graph’ link and when the chart have show up. Click on ‘refresh’ button on stackblitz preview (not browser refresh). And when stackblitz is bundling app (the text Bundling App is appearing), hit back button on mouse and the error will occur after bundling app is finish.
This time the error occur every time I try. Here is my hardware info
Update gif file to show reproduce step.
What is the motivation / use case for changing the behavior?
Environment
@angular/cli: 1.4.7
node: 8.7.0
os: darwin x64
@angular/animations: 4.4.5
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/flex-layout: 2.0.0-beta.9
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.5.3
this happens in angular 5.0.0-rc.2 too
Browser:
- [x] Chrome (desktop) version 62
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.7.0
- Platform: MacOS High Sierra, Linux Ubuntu 16.04
Others:
Actually I sent a pull request to fix this problem but seem like no one noticed it so I post an issue here. I just add
if (this._fetchNamespace(namespaceId)) {
this._fetchNamespace(namespaceId).insertNode(element, parent);
}
and the bug has gone.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 19 (7 by maintainers)
Commits related to this issue
- fix(animations): guard against views being removed/inserted quickly Closes #19712 — committed to matsko/angular by matsko 7 years ago
- fix(animations): avoid animation insertions during router back/refresh Closes #19712 — committed to matsko/angular by matsko 6 years ago
- fix(animations): avoid animation insertions during router back/refresh Closes #19712 — committed to matsko/angular by matsko 6 years ago
- fix(animations): avoid animation insertions during router back/refresh (#21977) Closes #19712 PR Close #21977 — committed to angular/angular by matsko 6 years ago
- fix(animations): avoid animation insertions during router back/refresh (#21977) Closes #19712 PR Close #21977 — committed to leo6104/angular by matsko 6 years ago
Alright I was able to reproduce it 😃
Looks like a race condition, I got the error after several tries with chromium 62.
Maybe some cpu throttling may make it easier to catch.