react-leaflet
react-leaflet copied to clipboard
Fixes issue with Map Container is already initialized
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
Any updates here? 👀
Hi, any update on this PR?😎
Until this is merged and a new release is created, you can use my branch by adding the following in your package.json
"react-leaflet": "https://github.com/mistenkt/react-leaflet/archive/refs/tags/react-leaflet-v4.2.1-gitpkg.tar.gz",
we've been using it in prod for a few months now without any issues.
Until this is merged and a new release is created, you can use my branch by adding the following in your package.json
"react-leaflet": "https://github.com/mistenkt/react-leaflet/archive/refs/tags/react-leaflet-v4.2.1-gitpkg.tar.gz",we've been using it in prod for a few months now without any issues.
Thank you! It works very well for me!
We are also facing this issue, which is breaking hot reloads on our pages that have maps on them. @PaulLeCam can this PR be merged and a new release be created? Thanks!
This fixed the issue for us as well. If we can do anything to help get this PR merged into the new release, let us know. Much appreciated.