Error after moving a node (with convert field depending on start date and baseline start)

Support for v6.x of our Scheduling components


Post Reply
User avatar
Omega Code
Posts: 30
Joined: Wed Aug 14, 2019 11:27 am

Error after moving a node (with convert field depending on start date and baseline start)

Post by Omega Code »

We are getting an error in JS console while moving a single node in the tree even when there are only few nodes present.

initial state
initial state
step 1.png (37.08 KiB) Viewed 587 times

After that application breaks (tooltip hangs, etc) and an error shows up in the console:

state after moving a task to another parent
state after moving a task to another parent
step 2.png (72.18 KiB) Viewed 587 times

(Uncaught RangeError: Maximum call stack size exceeded)

Here is a working testcase:

BTC_69673.zip
working test case
(4.86 MiB) Downloaded 33 times

The source of this problem seems to be in the task model and it's converted field that depends on start date and baseline start date.
The code of the model is shown below:

Code: Select all

Ext.define('OmegaCode.gantt.model.Task', {
    extend : 'Gnt.model.Task',
    fields: [
        {
            name: 'start_base_deviation',
            type: 'number',
            depends: [
                'StartDate',
                'BaselineStartDate'
            ],
            convert: function (v, rec) {
                return Ext.Date.diff(
                    new Date(Ext.Date.format(rec.data.StartDate,'Y-m-d')),
                    new Date(Ext.Date.format(rec.data.BaselineStartDate,'Y-m-d')),
                    Ext.Date.DAY
                );
            }
        }
    ],
});

Is there a way to fix this?
Is it a bug?
Or are we doing something wrong here?

Kind Regards
and thank You upfront for any help with that


User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 3070
Joined: Fri Apr 01, 2016 11:08 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by pmiklashevich »

I see no Bryntum code involved into the problem according to your stacktrace. Please set a breakpoint and try to debug what happens there. Let us know of the progress, so if our code is involved we can address. Thanks!

Pavel Miklashevich - Core Developer

User avatar
Omega Code
Posts: 30
Joined: Wed Aug 14, 2019 11:27 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by Omega Code »

I am most sure the problem is with ext.gantt's implementation of some logic for task model's fields: date start and baseline date start, that leeds to an endless loop in our case while performing simple operation


User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 3070
Joined: Fri Apr 01, 2016 11:08 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by pmiklashevich »

I copied your demo to "examples" folders next to "bigdataset", removed lib files and fixed requirement to make it work. I see no error while dragging a task. Please check out the attachment and try it yourself. Let me know please if you're able to reproduce the error.

P.S. Make sure you're using the latest sources. You can download new source from the customer zone.

Attachments
BTC_69673.zip
(16.12 KiB) Downloaded 36 times
Pavel Miklashevich - Core Developer

User avatar
Omega Code
Posts: 30
Joined: Wed Aug 14, 2019 11:27 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by Omega Code »

Thank You Pavel,
yet this didn't work for us at all.
We updated Your package (download/file.php?id=10823) with newest extjs 7.2 and ext.gantt 6.1.7 and the result is the same as before.

Below is the full call stack from the error (that includes gnt-all-debug.js occurrences in bold):

You can see that those calls are reoccurring 9 times even though we only have 3 nodes in play

Code: Select all

-------------------------------------------------------------------------------------------------------------------
ext-all-debug.js:225878 Uncaught RangeError: Maximum call stack size exceeded
    at constructor.getRowId (ext-all-debug.js:225878)
    at constructor.getNodeByRecord (ext-all-debug.js:225893)
    at constructor.getNode (ext-all-debug.js:202893)
    at constructor.onUpdate (ext-all-debug.js:202350)
    at constructor.relayFn (ext-all-debug.js:244944)
    at constructor.onUpdate (ext-all-debug.js:245075)
    at constructor.fire (ext-all-debug.js:22904)
    at constructor.doFireEvent (ext-all-debug.js:23944)
    at constructor.prototype.doFireEvent (ext-all-debug.js:66482)
    at constructor.fireEventArgs (ext-all-debug.js:23798)
getRowId	@	ext-all-debug.js:225878
getNodeByRecord	@	ext-all-debug.js:225893
getNode	@	ext-all-debug.js:202893
onUpdate	@	ext-all-debug.js:202350
relayFn	@	ext-all-debug.js:244944
onUpdate	@	ext-all-debug.js:245075
fire	@	ext-all-debug.js:22904
doFireEvent	@	ext-all-debug.js:23944
prototype.doFireEvent	@	ext-all-debug.js:66482
fireEventArgs	@	ext-all-debug.js:23798
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
fireEvent	@	ext-all-debug.js:23755
onCollectionItemChange	@	ext-all-debug.js:104425
notify	@	ext-all-debug.js:85239
itemChanged	@	ext-all-debug.js:84050
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910
callJoined	@	ext-all-debug.js:122976
endEdit	@	ext-all-debug.js:94858
callParent	@	ext-all-debug.js:13647
[b]endEdit	@	gnt-all-debug.js?ver=6.1.7:5180[/b]
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22275
callParent	@	ext-all-debug.js:13647
(anonymous)	@	ext-all-debug.js:22283
[b]refreshCalculatedParentNodeData	@	gnt-all-debug.js?ver=6.1.7:25271[/b]
[b]recalculateParents	@	gnt-all-debug.js?ver=6.1.7:25277[/b]
[b]onEndUpdate	@	gnt-all-debug.js?ver=6.1.7:33725[/b]
endUpdate	@	ext-all-debug.js:90736
onCollectionEndUpdate	@	ext-all-debug.js:100920
notify	@	ext-all-debug.js:85239
endUpdate	@	ext-all-debug.js:83575
itemChanged	@	ext-all-debug.js:84053
afterChange	@	ext-all-debug.js:104430
afterEdit	@	ext-all-debug.js:104437
[b]afterEdit	@	gnt-all-debug.js?ver=6.1.7:31188[/b]
callTreeStore	@	ext-all-debug.js:122910

User avatar
mats
Core Developer
Core Developer
Posts: 16566
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by mats »

What are the exact steps to reproduce?

Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
Omega Code
Posts: 30
Joined: Wed Aug 14, 2019 11:27 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by Omega Code »

steps to reproduce are:
1. drag node called "move me to p1" to a node called "p1" (or even to that top node called "test case 69673" - result should be the same)
2. see the error in console / app crashes partially


User avatar
mats
Core Developer
Core Developer
Posts: 16566
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by mats »

Ok, this is a better version which works:

Code: Select all

Ext.define('OmegaCode.gantt.model.Task', {
    extend : 'Gnt.model.Task',
    fields: [
        {
            name: 'start_base_deviation',
            type: 'number',
            depends: [
                'StartDate',
                'BaselineStartDate'
            ],
            convert: function (v, rec) {
                if (rec.data.StartDate && rec.data.BaselineStartDate) {
                    return Ext.Date.diff(
                        Ext.Date.clearTime(rec.data.StartDate),
                        Ext.Date.clearTime(rec.data.BaselineStartDate),
                        Ext.Date.DAY
                    );
                }
            }
        }
    ],
});
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
Omega Code
Posts: 30
Joined: Wed Aug 14, 2019 11:27 am

Re: Error after moving a node (with convert field depending on start date and baseline start)

Post by Omega Code »

Many Thanks Mats,
It indeed solved our problem.

PS: I'must have thought "depends" attribute is covering this "if" logic.


Post Reply