gantt-task-react icon indicating copy to clipboard operation
gantt-task-react copied to clipboard

Uncaught RangeError: Invalid array length at Array.concat (<anonymous>)

Open jasonusdid opened this issue 2 years ago • 4 comments

Hi,

I created a project task with many sub project/task, but when collaps the top project, it failed and showed below error. Please help to check. Thanks.

image

image

jasonusdid avatar Jun 29 '22 06:06 jasonusdid

Solved it changing in file other-helper.ts in method getChildren, this:

var taskChildren = tasks.reduce(function (children, t) { return children.concat(children, getChildren(taskList, t)); }, []);

For this:

var taskChildren: Task[] = []; tasks.forEach(t => { taskChildren.push(...getChildren(taskList, t)); })

I have not fully tested this solution, but I guess it's doing the same.

maberalc avatar Jun 30 '22 10:06 maberalc

Thanks for the quick fix. How can I integrate the fix in my project please? I have updated the package, it's still v0.3.8... and tested the function it still error out with the same reason.

Thanks.

jasonusdid avatar Jul 04 '22 02:07 jasonusdid

You have to build this package, then I had to delete node_modules (I was using create-react-app to test this library) and reinstall everything. Then change the new build in /node_modules/gantt-task-react/dist directory with the files in dist folder (created after build). Then when you use npm start, it should be okay.

maberalc avatar Jul 05 '22 07:07 maberalc

@jasonusdid I'm trying to change the columns in our Gantt, and add margin to the left on childtasks, as you did. How did you achieve it ?

lems3 avatar Mar 11 '24 18:03 lems3