Once the application has started, click on Show and you will immediately notice the lag in width of the grid.
However, if you click on the Show to hide the chart and show again, the lag is gone but there is still a subtle width “jumping” issue.
Not using it caused redundant re-initializations and repaints of Gantt (explained here https://reactjs.org/docs/hooks-reference.html#conditionally-firing-an-effect ), which I think was responsible for jumping grid width.
After I change it, the Gantt is re-initialized only when the display changes and only the problem seems gone.
Thanks for the pointer. I just tried it, and it seem to have fixed the issue but doesn’t make much sense to me though.
That is the reason why I put it as [] which only initialize when the component mount and unmount which means that gantt on paint once when the component is mounted. And if you look further below, I have another effect which has [display] as the dependency which only update show_chart whenever display props changes.
Placing [display] on the useEffect section that you mentioned meant that everytime display props changes, re-init gantt, together with all the config I set inside the useEffect.
If you have a different understanding, please let me know.
The issue is that imagine you scroll half way down the list (50th of 100 tasks), and currently display is true which means you are halfway, and the chart is shown.
Now, the display is set to false which will hide the Chart but current scroll state will jump back to the first task.
I suspecting that it is because I am re-init the gantt again due to the display change because display is init together with init.
But when you reinitialize Gantt, it doesn’t save the scroll property anywhere.
So you can save the scroll position before reinitializing Gantt and scroll to that position after the reinitialization.
Here is the snippet: http://snippet.dhtmlx.com/f59707829
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan