d4rkr00t / prosemirror-dev-tools

Developer Tools for ProseMirror
317 stars 37 forks source link

Add methods to properly unmount the component & UNSAFE flag to componentWillReceiveProps #107

Closed TeemuKoivisto closed 1 year ago

TeemuKoivisto commented 3 years ago

So as stated in the title, this fixes the error messages where React complains that devTools has not been unmounted properly using ReactDOM.unmountComponentAtNode.

Basically with the current version this is never called properly and with this patch you can call it in a eg useEffect hook or such. Also this adds UNSAFE flag to componentWillReceiveProps which should stop React from complaining from using it. I guess it also prevents a bug in React 17 where they altogether remove those methods and only UNSAFE methods will work. A better idea would of course be to update the component to eg function component with hooks but I don't know if anyone has the time and willingness for that.

jessicalc commented 3 years ago

I believe I'm running into this error as well. Is this the error your patch is intended to fix?:

Warning: render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.

Thanks!

TeemuKoivisto commented 3 years ago

Hey @jessicalc. I think it did, can't recall exactly anymore. It seems the maintainer has become active again so maybe he'll work it out.