TreeTable - Converting circular structure to JSON *solved*

UI Components for Angular
Post Reply
koesper
Posts: 8
Joined: 20 Feb 2017, 09:41

09 Jul 2019, 15:13

I'm trying to get the TreeTable to work in my project, but when I expand the table, i get a Circular structure error in the console.

Code: Select all

ERROR
Error: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'children' -> object with constructor 'Array'
| index 0 -> object with constructor 'Object'
--- property 'parent' closes the circle
I've been able to recreate it in this stackblitz:
https://stackblitz.com/edit/github-uxyk8d
(based on the example in https://www.primefaces.org/primeng/#/treetable)


It might relate to this bugreport, but I dont see what the solution should be
https://github.com/primefaces/primeng/issues/2706

koesper
Posts: 8
Joined: 20 Feb 2017, 09:41

09 Jul 2019, 16:12

Solved it...
This was an official heisenbug... it only existed when debugging....

I added a line in my html to see the structure the TreeTable was based on...

Code: Select all

<pre>{{files | json}}</pre>

Apparently, when you press the treetabletoggler, that structure is updated, with parent&child objects, creating a circular structure...
And the '| json' pipe cant handle that..

The problem wasnt in TreeTable, but in my code. Remove the debug line, and it works!

yigitfindikli
Posts: 449
Joined: 08 Aug 2018, 14:09

10 Jul 2019, 08:14

koesper wrote:
09 Jul 2019, 16:12
Solved it...
This was an official heisenbug... it only existed when debugging....

I added a line in my html to see the structure the TreeTable was based on...

Code: Select all

<pre>{{files | json}}</pre>

Apparently, when you press the treetabletoggler, that structure is updated, with parent&child objects, creating a circular structure...
And the '| json' pipe cant handle that..

The problem wasnt in TreeTable, but in my code. Remove the debug line, and it works!
Glad to hear!

Best Regards.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests