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

React 19 Old Error Back: Uncaught Error: Map container is already initialized.

Open GeorgSteyn opened this issue 1 month ago • 1 comments

Bug report in v4

  • [X] All peer dependencies are installed: React, ReactDOM and Leaflet.
  • [ ] Using the latest version of React and ReactDOM v18.
  • [X] Using the supported version of Leaflet (v1.8.0 minimum) and its corresponding CSS file is loaded.
  • [X] Using the latest v4 version of React-Leaflet.
  • [X] The issue has not already been reported.
  • [X] Make sure you have followed the quick start guide for Leaflet.
  • [X] Make sure you have fully read the documentation and that you understand the limitations.

Expected behavior

Working

Actual behavior

Well upgraded project to React 19 RC and the error popped up. Same as the past with ReactJs Upgrades Not working getting error: Uncaught Error: Map container is already initialized.

Steps to reproduce

Upgrade project to React 19

GeorgSteyn avatar May 16 '24 13:05 GeorgSteyn

I tried to upgrade a big app from react 18.3.0 to latest react 19 rc (19.0.0-rc-915b914b3a-20240515) and I'm facing the same issue.

Here is the simplest repro : https://codesandbox.io/p/sandbox/thirsty-zeh-34ddlm

Thanks for your help.

cedric-marcone avatar May 17 '24 08:05 cedric-marcone

The issue seems to go away by disabling Strict Mode. Even tho this is not a viable solution, it's a way to get it working until it gets fixed 👍

kevinbioj avatar May 23 '24 19:05 kevinbioj