issue with onDraggedColumnChange being called before rendering is complete.
ds-martinso opened this issue · 0 comments
I have a scenario where a parent renders a Draggable Table. The parent makes use of the draggable's callback, onDraggedColumnChange, to rerender other things whenever a column is reordered.
The issue I am facing is that the Draggable Table will rerender at the same time as the parent, which causes the following warning:
Warning: Cannot update a component (
parent) while rendering a different component (
RTDraggableColumn). To locate the bad setState() call inside
RTDraggableColumn, follow the stack trace...
I do have a solution to prevent this warning, by using setTimeout, which lets the Draggable Table render first before rendering the parent. But this is not how I really want to solve it, and I thought that the issue instead lies in the onDraggedColumnChange callback.
Now your callback is probably be fully correct, and works in "normal" scenarios, but it does not really fit in for me.
What I instead would need is to have the callback after the Draggable Table renders.
Or do you know how I can prevent the warning I am seeing? Or have a better solution than me using a timeout?
Thanks!