[Ivy] ASSERTION ERROR: Should be run in update mode
See original GitHub issueπ bug report
Affected Package
The issue is caused by package @angular/core (Ivy)Is this a regression?
Yes, works in non-Ivy.
Description
I suspect this happens as a result of having an Input property that is set directly (isExpanded="true") instead of using a binding ([isExpanded]="true"), and having the property setter call changeDetectorRef.detectChanges(). It should be noted that this works in non-ivy.
π¬ Minimal Reproduction
https://github.com/fr0/angular-test/tree/ivy
- Clone repo
git checkout ivynpm installnpm start- Open http://localhost:4200 in Chrome
- View browser console log
π₯ Exception or Error
core.js:5829 ERROR Error: ASSERTION ERROR: Should be run in update mode
at throwError (core.js:1164)
at assertEqual (core.js:1123)
at refreshView (core.js:12425)
at detectChangesInternal (core.js:13907)
at ViewRef.detectChanges (core.js:15373)
at ExpandableIfComponent.set isExpanded [as isExpanded] (expandable-if.component.ts:60)
at setInputsFromAttrs (core.js:13579)
at postProcessDirective (core.js:13335)
at instantiateAllDirectives (core.js:13234)
at createDirectivesInstances (core.js:12618)
π Your Environment
Angular Version:
Angular CLI: 9.0.0-next.5
Node: 12.6.0
OS: darwin x64
Angular: 9.0.0-next.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.0-next.5
@angular-devkit/build-angular 0.900.0-next.5
@angular-devkit/build-optimizer 0.900.0-next.5
@angular-devkit/build-webpack 0.900.0-next.5
@angular-devkit/core 9.0.0-next.5
@angular-devkit/schematics 9.0.0-next.5
@angular/cli 9.0.0-next.5
@ngtools/webpack 9.0.0-next.5
@schematics/angular 9.0.0-next.5
@schematics/update 0.900.0-next.5
ng-packagr 5.5.1
rxjs 6.5.3
typescript 3.5.3
webpack 4.40.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:32 (5 by maintainers)
Top Results From Across the Web
ASSERTION ERROR: Should be run in update mode ...
I got it all working,. I have placed the function getVersionInfos in the ngOnInit instead of inside the constructor.
Read more >ASSERTION ERROR: Should be run in update mode ...
Coding example for the question how to fix Error: ASSERTION ERROR: Should be run in update mode [Expected=> false == true <=Actual]-angular.js.
Read more >Template type checking - Angular
In the most basic type-checking mode, with the fullTemplateTypeCheck flag set to false , Angular validates only top-level expressions in a template.
Read more >Problem with Assertion Error : r/Angular2 - Reddit
Well, I have a material table with expandable rows, a service that handles the addition of items to the table. So, this error...
Read more >sbt/sbt - Gitter
What do I need to setup to use an external zinc server process for compilation? ... AssertionError: assumption failed: Constant pool entry is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
oh, the same issue (angular 9.1.7 with { ngZone: βnoopβ })
resolved it by moving logic out of constructor to ngOnInit
@BzenkoSergey It worked! You are a champ!
Looked through my companyβs project for ALL logic defined in components constructors, and moved anything I found to ngOnInit, and bam, no error.