bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

[ExtJS] Maximum call stack when collecting data for propagation #9941

Open arcady-zherdev opened 3 weeks ago

arcady-zherdev commented 3 weeks ago

Forum post

Hi Bryntum Team,

I'm encountering an issue with the live advanced demo example (version 6.1.23) when working with large datasets. Specifically, we've created Parent Tasks (Planning) within a Project/Board Node (Project A). The activities inside the Parent Tasks are connected by waterfall dependencies.

I encounter errors, and changes no longer propagate as expected during operations such as:

Changing duration values through the duration column. Resizing (stretching) an activity. Changing dates through the dates column.

Could you please provide guidance on how to resolve this issue? Any advice on optimizing performance for larger datasets would be greatly appreciated.

For your reference, please find the attached screenshot and dataset (load.JSON).

Thank you! load.json

P.S. Arcady: The issue reason is this recursive call:

    function collectTasksAndDepsIntoColorMaps$(tasksList, stepTasksDepsCollectorFn$, tasksMap$, depsMap$) {

        Ext.Array.each(tasksList, function(task) {

            var collectedTasks = stepTasksDepsCollectorFn$(task, tasksMap$, depsMap$);

            if (collectedTasks.length > 0) {
                collectTasksAndDepsIntoColorMaps$(collectedTasks, stepTasksDepsCollectorFn$, tasksMap$, depsMap$);
            }
        });
    }

the following code change helps:

    function collectTasksAndDepsIntoColorMaps$(tasksList, stepTasksDepsCollectorFn$, tasksMap$, depsMap$) {

        var tasksToProcess = [].concat(tasksList);
        var task;

        while (task = tasksToProcess.shift()) {

            var collectedTasks = stepTasksDepsCollectorFn$(task, tasksMap$, depsMap$);

            if (collectedTasks.length > 0) {
                tasksToProcess.unshift.apply(tasksToProcess, collectedTasks);
            }
        }
    }