react-leaflet icon indicating copy to clipboard operation
react-leaflet copied to clipboard

Fixes issue with Map Container is already initialized

Open mistenkt opened this issue 1 year ago • 6 comments

Was running into this error quite frequently when using this library on a Next project where our maps were being loaded using next/dynamic to prevent SSR.

Previous suggestions about adding keys to the MapContainer component were not working.

Noticed that the code for checking if we have an existin context is not actually updated if/when the context changes, and instead explicitly ignoring the lint warnings for this. // eslint-disable-next-line react-hooks/exhaustive-deps.

This fixes the problem.

Related issue: https://github.com/PaulLeCam/react-leaflet/issues/1069

mistenkt avatar Apr 19 '23 09:04 mistenkt