Comments (4)
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 š
from react-leaflet.
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.
from react-leaflet.
workaround:
const isInitialized = useRef(false);
useEffect(() => {
isInitialized.current = true;
return () => {
isInitialized.current = false;
};
}, []);
if (!isInitialized) return null;
from react-leaflet.
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 š
I encountered the same issue while testing this in the Next.js v15 RC.
The Map container fails to mount, even with dynamic loading.
A temporary workaround as you mentioned is to disable reactStrictMode for the entire app by setting { reactStrictMode: false } in next.config.
Hopefully, we can find a proper solution soon.
__
Not sure what is causing the component to initialize twice, I may need to break out of react-leaflet.
from react-leaflet.
Related Issues (20)
- ESM packages (@react-leaflet/core) need to be imported.
- Iām interested in enhancing the documentation.
- BUG: Control Component event handling HOT 2
- How to add an additional layer?
- MapContainer whenReady doesn't receive target parameter from Leaflet HOT 1
- Problem with rendering OS Maps Leisure Layers HOT 1
- [Turbopack] Parsing css source code failed HOT 5
- Help please
- error rendering <Marker> component in react
- Prevent Vector Layer to automatic scale HOT 3
- Is everything okay with Nextjs v14.1.0 + React v18? Maps doesn't render HOT 4
- Get Distance Function? HOT 2
- How to hide the API Key in the TileLayer?
- Marker is missing data type in typescript definition
- Is there a way to calculate a circle with a 150-meter radius around the marker? HOT 1
- Change the map of India and add entire Kashmir in it HOT 1
- L.divIcon is not working
- Cannot read properties of undefined (reading '_leaflet_pos') HOT 1
- Re-add `whenCreated` to MapContainer or allow class based React projects access to `Map` without hooks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-leaflet.