You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
18.1.4
Description
Starting from @angular/cdk version 18.2.0, a bug got introduced which causes "Maximum call stack size exceeded" errors when we have a tree node with many dynamic children. From our observations, it can start already from +/- 500 child nodes.
It does not need to be deeply nested, just 1 level deep is enough, but the amount of child nodes matters.
I have not been able to reproduce it with flat cdk-tree-node, only when using the cdk-nested-tree-node. Even then, it only seems to happen when loading children dynamically plus timing (network delay) also seems to play a role.
The errors look like this:
NOTE: it can also be reproduced using the treeControl instead of childrenAccessor (like we would write it before v18.2.0). That makes no difference. Please let me know if you would like to see an example of that on StackBlitz as well...
The CDK tree was calling `ChangeDetectorRef.detectChanges` recursively for each node in the tree which was overflowing the call stack with some larger trees.
These changes resolve the issue by only calling `detectChanges` on the root.
Fixesangular#29733.
The CDK tree was calling `ChangeDetectorRef.detectChanges` recursively for each node in the tree which was overflowing the call stack with some larger trees.
These changes resolve the issue by only calling `detectChanges` on the root.
Fixes#29733.
(cherry picked from commit be004b8)
Is this a regression?
The previous version in which this bug was not present was
18.1.4
Description
Starting from @angular/cdk version 18.2.0, a bug got introduced which causes "Maximum call stack size exceeded" errors when we have a tree node with many dynamic children. From our observations, it can start already from +/- 500 child nodes.
It does not need to be deeply nested, just 1 level deep is enough, but the amount of child nodes matters.
I have not been able to reproduce it with flat
cdk-tree-node
, only when using thecdk-nested-tree-node
. Even then, it only seems to happen when loading children dynamically plus timing (network delay) also seems to play a role.The errors look like this:
NOTE: it can also be reproduced using the
treeControl
instead ofchildrenAccessor
(like we would write it before v18.2.0). That makes no difference. Please let me know if you would like to see an example of that on StackBlitz as well...Reproduction
StackBlitz link: https://stackblitz.com/edit/qmvryx-5s6t5r?file=src%2Fexample%2Fcdk-tree-nested-children-accessor-example.ts
Steps to reproduce:
Expected Behavior
No errors in console.
Actual Behavior
An explosion of errors:
RangeError: Maximum call stack size exceeded
Environment
Angular CLI: 18.2.4
Node: 20.12.2
Package Manager: pnpm 9.8.0
OS: win32 x64
Angular: 18.2.4
... animations, build, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.1802.4 (cli-only)
@angular-devkit/core 18.2.4 (cli-only)
@angular-devkit/schematics 18.2.4 (cli-only)
@angular/cdk 18.2.3
@angular/material 18.2.3
@schematics/angular 18.2.4
rxjs 7.8.1
typescript 5.5.4
webpack 5.91.0
zone.js 0.14.10
The text was updated successfully, but these errors were encountered: