konvajs/react-konva-utils

HTML Component Attempts to Unmount synchronously when removed from the DOM

markcnunes opened this issue ยท 4 comments

I see there is an issue opened already mentioning the unmount synchronously warning:
#25

But I am opening a new issue because what I want to raise only appears when Html is removed from the DOM. See the example below:

ezgif-3-136bd71999.mp4

I noticed this issue is related to how Konva is imported in Next.js (as mentioned in this other issue) because I tested it in a React environment without Next.js and the error didn't happen when the Html was removed from the DOM.

Here is a reproducible repository with Html and Next.js

@markcnunes Thanks for posting this... see issue 25

As an aside, I dont use Next.js, and i have this problem. I created my app framework with create_react_app.

@davesargrad no worries, I saw that issue before creating this one and I mentioned it in the description. However, my case only happens when I remove the Html from the canvas, otherwise, it works fine for Next.js but it is good to know your issue happens with create_react_app. I will let the maintainers decide if this is exactly the same issue you mentioned and close this one if it makes sense.

@markcnunes Ty for that thought. As I think about when it is happening to me, I think it may also be that Html is being removed from the DOM. I have a single page application (SPA).. There are many views. The error I see happens when one of the views that has a Konva canvas is redrawn with other information. At that point, I think the Html component is unmounted (from the DOM), and then remounted in the updated view. So I really think that your finding is a great finding. I think under the covers they may be the same fundamental issue with the code.

Thanks for the reproducible repo. It should be fixed with react-konva-utils@1.0.3.