[React] Gantt as ref in React and re-rendering chart

Is there a reason Gantt React wrappers are using refs? I was thinking about refactoring the gantt to not use a ref.

I’m encountering an issue where I have a react onSave method that fires of a relay mutation to save all link updates on the chart.

The save works successfully, but since this isn’t a gantt event the chart doesn’t re-render. My Gantt is wrapped in a ref so I don’t have a clean way to force update the gantt component. How do people typically re render gantt after non gantt events?

I’ve noticed that only lightbox events save and render right after, but that’s because of the specific events attached to lightbox. I’m not able to use the similar events for links because I’m sending all link updates as 1 mutation.


You can use gantt.render() command to rerender the chart. Or if you want to update specific tasks or links you can use gantt.updateTask(id) or gantt.updateLink() respectively:

Here is a demo: