Maximum call stack in treetable in primeng 7

UI Components for Angular
Post Reply
nasrul
Posts: 10
Joined: 28 Jun 2018, 12:13

04 Jan 2019, 08:28

When I upgraded the primeng from version 6 to 7 along with angular, I am getting the below error in treetable. Especially during selection and no of rows selection. Kindly provide some feedback here.
PlanDesignComponent.html:57 ERROR RangeError: Maximum call stack size exceeded
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:20)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:30)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:30)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:30)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
at ObjectUtils.push../node_modules/primeng/components/utils/objectutils.js.ObjectUtils.equalsByValue (objectutils.js:55)
View_PlanDesignComponent_8
It is occurring in the line

Code: Select all

<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode" [ttContextMenuRow]="rowNode">

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

04 Jan 2019, 11:22

Hi,
can i see your code ?

nasrul
Posts: 10
Joined: 28 Jun 2018, 12:13

04 Jan 2019, 14:28

Code: Select all

<p-treeTable [value]="data" [columns]="tableConfigData"
                         selectionMode="multiple" [(selection)]="selectedNodes"
                         [metaKeySelection]="true" (onNodeSelect)="nodeSelect($event)"
                         (onNodeUnselect)="nodeUnSelect($event)" [contextMenu]="cmA"
                         contextMenuSelectionMode="joint" (onContextMenuSelect)="contextMenuSelection($event)"
                         [reorderableColumns]="true"
                         (onColReorder)="reorderedColumns()"
                         (onPage)="paginationEvent($event)"
                         [resizableColumns]="true" [paginator]="true" [rows]="rowCount" [pageLinks]="10"
                         [rowsPerPageOptions]=planDesignConfigService.rowsPagePerOption [scrollable]="isScroll"
                         (onSort)="getPlansDesigns($event)" [customSort]="true">
                <ng-template pTemplate="colgroup" let-columns>
                    <colgroup>
                        <col *ngFor="let col of columns">
                    </colgroup>
                </ng-template>
                <ng-template pTemplate="header" let-columns>
                    <tr>
                        <th align="left" *ngFor="let col of columns"
                            [ttSortableColumn]="col.field" ttResizableColumn
                            ttReorderableColumn>
                            {{col.header}}
                            <p-treeTableSortIcon *ngIf= "col.field !== 'type'"
                                    [field]="col.field"></p-treeTableSortIcon>
                        </th>
                    </tr>
                </ng-template>
                <ng-template pTemplate="body" let-rowNode let-rowData="rowData"
                             let-columns="columns">
                    <tr [ttSelectableRow]="rowNode" [ttContextMenuRow]="rowNode">
                        <td *ngFor="let col of columns; let i = index">
                            <p-treeTableToggler [rowNode]="rowNode"
                                                *ngIf="i == 0"></p-treeTableToggler>
                            {{col.type === 'date' ? (rowData[col.field] | date: dateFormat) : rowData[col.field]}}
                        </td>
                    </tr>
                </ng-template>
            </p-treeTable>
<p-contextMenu #cmA [model]="contextAMenu"></p-contextMenu>
<p-contextMenu #cmB [model]="contextBMenu"></p-contextMenu>
Please find the HTML code, I hope it will give you more idea

nasrul
Posts: 10
Joined: 28 Jun 2018, 12:13

04 Jan 2019, 15:12

yigitfindikli wrote:
04 Jan 2019, 11:22
Hi,
can i see your code ?
updated the code

skormel
Posts: 5
Joined: 14 Nov 2016, 16:26

07 Jan 2019, 12:19

We've got similar error on p-tree after upgrading from primenNG 6 to 7.

I created a issue no github with the error:

https://github.com/primefaces/primeng/issues/7068

Rvdabeele
Posts: 6
Joined: 28 Aug 2017, 11:05

21 Jan 2019, 17:13

I've added additional info to this ticket.
https://github.com/primefaces/primeng/i ... -456099962

This issue is by no means only linked to p-treetable, p-table and others are also affected by it.

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

22 Jan 2019, 10:13

I couldn't replicate it. But seems to be important. Could you please provide stackblitz case ?

https://stackblitz.com/github/primeface ... e-template

Rvdabeele
Posts: 6
Joined: 28 Aug 2017, 11:05

22 Jan 2019, 15:57

I've added a simple StackBlitz to the github issue.

Please do mind; StackBlitzes don't do this justice. The refactor of the equalsByValue messed the logic of that method up. It needs fixing.

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

22 Jan 2019, 16:50

Rvdabeele wrote:
22 Jan 2019, 15:57
I've added a simple StackBlitz to the github issue.

Please do mind; StackBlitzes don't do this justice. The refactor of the equalsByValue messed the logic of that method up. It needs fixing.
I'll check. Thanks for the example.

Rvdabeele
Posts: 6
Joined: 28 Aug 2017, 11:05

22 Jan 2019, 18:35

yigitfindikli wrote:
22 Jan 2019, 16:50
Rvdabeele wrote:
22 Jan 2019, 15:57
I've added a simple StackBlitz to the github issue.

Please do mind; StackBlitzes don't do this justice. The refactor of the equalsByValue messed the logic of that method up. It needs fixing.
I'll check. Thanks for the example.
No problem.

The commit that bugged equalsByValue can be found at https://github.com/primefaces/primeng/c ... 4dac9c2e63
"visited" was a cache so objects wouldn't get checked multiple times. This got taken out (for whatever refactoring reason).

I'm still not sure what exactly triggers this behavior in tables / trees / dropdowns, and that is probably worth investigating, but for now safe-guarding a deep-equals against infinite loops makes too much sense not to do.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Sparks260 and 2 guests