[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.

Thanks,
testuser3

Hello,
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:
https://docs.dhtmlx.com/gantt/api__gantt_render.html
https://docs.dhtmlx.com/gantt/api__gantt_updatetask.html
https://docs.dhtmlx.com/gantt/api__gantt_updatelink.html

Here is a demo:
https://files.dhtmlx.com/30d/4df82c5082dff66b7ccaf9dc441ac5df/react+rerender.zip