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 2 years ago • 7 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

Any updates here? 👀

yuzhakovvv avatar Jun 08 '23 21:06 yuzhakovvv

Hi, any update on this PR?😎

natBizitza avatar Jul 05 '23 09:07 natBizitza

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.

mistenkt avatar Jul 05 '23 09:07 mistenkt

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!

natBizitza avatar Jul 05 '23 10:07 natBizitza

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!

lemilonkh avatar Oct 25 '23 15:10 lemilonkh

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.

tswacast avatar Apr 26 '24 19:04 tswacast