Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛[Bug] Compatibility with react-leaflet v5 and React 19, old error No context provided: useLeafletContext() can only be used in a descendant of <MapContainer> #217

Open
amauryfischer opened this issue Dec 23, 2024 · 1 comment

Comments

@amauryfischer
Copy link
Contributor

amauryfischer commented Dec 23, 2024

This old error is back,

No context provided: useLeafletContext() can only be used in a descendant of "MapContainer"

I tried all the fixes we did in previous issue with compatibility with v4 and React 18, but not working for now.
Do you guys tried with React19 ?

@mrkvon
Copy link

mrkvon commented Dec 25, 2024

This is likely caused by mismatch in top-level dependencies and dependencies of this package.

I was able to patch this issue by upgrading react-leaflet and @react-leaflet/core dependencies of this package to latest versions.

With yarn v1, this was achieved by adding the following section to package.json and reinstalling:

  "resolutions": {
    "react-leaflet-markercluster/react-leaflet": "5.0.0",
    "react-leaflet-markercluster/@react-leaflet/core": "3.0.0"
  },

It's possible that other package managers have equivalent functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants