Heyo,
when parsing data into the Gantt, I sometimes get the following error:
ganttHelper.ts:60 TypeError: Cannot read properties of undefined (reading '$local_index')
at ./sources/ext/undo/monitor.ts.Monitor.onTaskMoved (dhtmlxgantt.js:56776:48)
at TreeDataStore.<anonymous> (dhtmlxgantt.js:56955:23)
at TreeDataStore.eventStorage (dhtmlxgantt.js:60230:39)
at obj.callEvent (dhtmlxgantt.js:60312:63)
at TreeDataStore.move (dhtmlxgantt.js:21119:10)
at TreeDataStore.$initItem (dhtmlxgantt.js:20813:12)
at TreeDataStore._parseInner (dhtmlxgantt.js:19570:21)
at TreeDataStore.parse (dhtmlxgantt.js:20958:23)
at gantt._process_loading (dhtmlxgantt.js:23262:27)
at gantt.on_load (dhtmlxgantt.js:23232:10)
at gantt.parse (dhtmlxgantt.js:23174:10)
at convertOrdersWithProjectsWithJobsIntoTasksAndParse (ganttHelper.ts:53:13)
at Gantt.svelte:553:5
With only a few tasks, this happens very rarely, but once I get into the 1000s of tasks, it becomes a constant pain. Currently I am forced to do the following:
for (let i = 0; i < numRetries; i++) {
try {
gantt.parse({
data: allData.tasks,
});
console.log('Retry tasks number: ' + i);
break;
} catch (e) {
...
}
}
The amount of retries necessary until it works, are random. Sometimes it works on the first or second retry, sometimes it takes a 150 iterations. This obviously adds a considerable overhead, taking up to 10 seconds.
My next step would be to turn every parsing into batches (I’ve already separated parent and children parsing), but this again would be slower than parsing all data at once.