Repository navigation
Closed
Labels
area: commonIssues related to APIs in the @angular/common packagearea: coreIssues related to the framework runtimeneeds reproductionThis issue needs a reproduction in order for the team to investigate further
Milestone
Description
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
No
Description
For some reason, calling ChangeDetectorRef#detectChanges() causes an error in NgForOf directive where view is null and therefore when calling viewContainer.move() there's a runtime TypeError due to attempting to read properties of null (see attached stack trace)
angular/packages/common/src/directives/ng_for_of.ts
Lines 250 to 251 in c88e87d
| const view = viewContainer.get(adjustedPreviousIndex)!; | |
| viewContainer.move(view, currentIndex); |
angular/packages/core/src/linker/view_container_ref.ts
Lines 431 to 432 in c88e87d
| override move(viewRef: ViewRef, newIndex: number): ViewRef { | |
| if (ngDevMode && viewRef.destroyed) { |
I managed to workaround this by calling ChangeDetectorRef#detectChanges() within window.setTimeout()'s callback.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
TypeError: Cannot read properties of null (reading 'destroyed')
at ViewContainerRef.move (core.mjs:22916:1)
at common.mjs:3194:31
at DefaultIterableDiffer.forEachOperation (core.mjs:27491:1)
at NgForOf._applyChanges (common.mjs:3182:17)
at NgForOf.ngDoCheck (common.mjs:3177:22)
at callHook (core.mjs:2552:1)
at callHooks (core.mjs:2511:1)
at executeCheckHooks (core.mjs:2443:1)
at selectIndexInternal (core.mjs:8399:1)
at Module.ɵɵadvance (core.mjs:8388:1)
Please provide the environment you discovered this bug in (run ng version)
Angular: 13.2.4
... animations, cdk, cdk-experimental, common, compiler
... compiler-cli, core, forms, language-service, localize
... material, platform-browser, platform-browser-dynamic, router
... service-worker, upgrade
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1302.5
@angular-devkit/build-angular 13.2.5
@angular-devkit/core 13.2.5
@angular-devkit/schematics 13.2.5
@angular/cli 13.2.5
@schematics/angular 13.2.5
rxjs 7.5.4
typescript 4.5.5
Anything else?
Possibly related to NativeScript/nativescript-angular#1221 (comment)
Reacted by Clément
Metadata
Metadata
Assignees
Labels
area: commonIssues related to APIs in the @angular/common packagearea: coreIssues related to the framework runtimeneeds reproductionThis issue needs a reproduction in order for the team to investigate further
Activity
JoostK commentedon Mar 23, 2022
Can you share a runnable reproduction please?
jessicajaniuk commentedon Mar 28, 2022
I'm sorry but we can't reproduce the problem you are reporting. We require that reported issues have a minimal reproduction that showcases the problem.
If the problem still exists in your application, please open a new issue and follow the instructions in the issue template that include info on how to create a reproduction using our template.
angular-automatic-lock-bot commentedon Apr 28, 2022
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.