Here's a stackbliz that reproduces the error: https://stackblitz.com/edit/primeng-tre ... onent.html
Note that this is a fork of your own Tree Filter example (https://www.primefaces.org/primeng/show ... ree/filter) but with the added selectionMode="checkbox".
To reproduce:
- Type "Exp" in the filter
- In the filtered tree click on the "Expenses.doc" node
Code: Select all
preview-eae476d1b788b94f49d4b.js:1 ERROR RangeError: Maximum call stack size exceeded
at Tree.syncNodeOption (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:908)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:981)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
at Tree.propagateUp (primeng-treefilter-checkbox-error.stackblitz.io/turbo_modules/primeng@11.3.0/bundles/primeng-tree.umd.js:985)
Tracing through your code it appears that after filtering, the parent node of the root node in the tree which *should* be null is instead a reference to itself, yielding an infinite loop during propagateUp.
It appears that when filtering nodes from step 1 above you are re-pointing some of the parent-child relationships and have introduced the infinite-loop.
If you do NOT filter (i.e. leave the filter empty) everything functions correctly.
NOTE: That while I have reproduced this error with the latest v11.x version of PrimeNg it's also occurring in the 9.xLTS version I'm actually using and would assume that the 9.xLTS version would also be fixed?
Thanks!
Bill