konvajs/react-konva-utils

Warning: Attempted to synchronously unmount a root while React was already rendering

Closed this issue · 3 comments

I am getting this error when my Html component unmounts:

react_devtools_backend.js:4045 Warning: Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.
    at Html (http://localhost:5173/node_modules/.vite/deps/react-konva-utils.js?v=4835bfa9:40:15)

Hello,

I was getting the same error pointed out above

image

But after using the solution (switching to useLayoutEffect), changing my local node_modules, I still having the warning but in a different way.

image

The solution for me in this case, was to completely remove this from html.js:

image

It may lead to memory leaks, if you remove that.

For me this cleared up the problem..

React.useEffect(() => {
return () => {
setTimeout(() => {
root.unmount();
});
};
}, []);