Exception thrown in p-tree when using filter and checkbox selection

UI Components for Angular
Post Reply
bcroteau
Posts: 2
Joined: 19 May 2017, 20:02

16 Apr 2021, 22:19

It would appear that the p-tree component is throwing an exception when filter="true" and selectionMode="checkbox" AND when the resulting list is filtered.

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:
  1. Type "Exp" in the filter
  2. In the filtered tree click on the "Expenses.doc" node
Note that the Expenses node is NOT checked and also note that the console contains the following error:

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)
This occurs in both the lenient and strict modes...

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

PhilHuhn
Posts: 177
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

23 Apr 2021, 02:48

Hey, I am just a fellow user, but this is not the place to submit a bug request. Try on GitHub...

https://github.com/primefaces/primeng

Then go to the issues tab. I have personally reported bugs there. Good luck.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests