VictorCazanave / react-svg-map

A set of React.js components to display an interactive SVG map
https://victorcazanave.github.io/react-svg-map/
MIT License
229 stars 48 forks source link

RadioSVGMap broken in React 17 #53

Open tgeorgiadis opened 3 years ago

tgeorgiadis commented 3 years ago

It appears RadioSVGMap is broken in React 17

I've made a Code Sandbox showing the error: https://codesandbox.io/s/reverent-goodall-5ox98?file=/src/App.js

Error: Minified React error #188; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=188 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Full text of error: Unable to find node on an unmounted component.

VictorCazanave commented 3 years ago

Thank you for reporting this issue @tgeorgiadis

I don't know when I have time to look at it, because currently I'm very busy. If you know how to fix it, feel free to open a PR! Btw I think your Code Sandbox is just an empty react application 🤔

BossBele commented 3 years ago

+1 on this

thomb commented 3 years ago

FWIW this same issue occurs with <CheckboxSVGMap />, that said as a workaround if you use the vanilla <SVGMap /> and manage state outside of this library you can generally get the same/similar behaviour of <CheckboxSVGMap /> and <RadioSVGMap />

VictorCazanave commented 3 years ago

CheckboxSVGMap seems to work with React 17: https://codesandbox.io/s/checkbox-svg-map-with-react-17-wx0pz

VictorCazanave commented 3 years ago

Although I couldn't fix it in a Code Sandbox, RadioSVGMap worked in a local project with React 17.0.2.

However, in strict mode, it throws a warning, because the deprecated ReactDOM.findDOMNode() in still used in RadioSVGMap and couldn't be replaced by ref since it's not supported on functional components in React 16.0.0.

@tgeorgiadis @BossBele if you got the error in a local project, could you provide a repository to reproduce it please?