Page 1 of 2

Maximum call stack in treetable in primeng 7

Posted: 04 Jan 2019, 08:28
by nasrul
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">

Re: Maximum call stack in treetable in primeng 7

Posted: 04 Jan 2019, 11:22
by yigitfindikli
Hi,
can i see your code ?

Re: Maximum call stack in treetable in primeng 7

Posted: 04 Jan 2019, 14:28
by nasrul

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

Re: Maximum call stack in treetable in primeng 7

Posted: 04 Jan 2019, 15:12
by nasrul
yigitfindikli wrote:
04 Jan 2019, 11:22
Hi,
can i see your code ?
updated the code

Re: Maximum call stack in treetable in primeng 7

Posted: 07 Jan 2019, 12:19
by skormel
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

Re: Maximum call stack in treetable in primeng 7

Posted: 21 Jan 2019, 17:13
by Rvdabeele
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.

Re: Maximum call stack in treetable in primeng 7

Posted: 22 Jan 2019, 10:13
by yigitfindikli
I couldn't replicate it. But seems to be important. Could you please provide stackblitz case ?

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

Re: Maximum call stack in treetable in primeng 7

Posted: 22 Jan 2019, 15:57
by Rvdabeele
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.

Re: Maximum call stack in treetable in primeng 7

Posted: 22 Jan 2019, 16:50
by yigitfindikli
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.

Re: Maximum call stack in treetable in primeng 7

Posted: 22 Jan 2019, 18:35
by Rvdabeele
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.