Skip to content

Fix/markercluster leaflet import order - #504

Merged
louismaximepiton merged 1 commit into
Orange-OpenSource:mainfrom
sebnic:fix/markercluster-leaflet-import-order
Oct 21, 2026
Merged

louismaximepiton merged 1 commit into
Orange-OpenSource:mainfrom
sebnic:fix/markercluster-leaflet-import-order

Conversation

@sebnic

@sebnic sebnic commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request updates the import order in iot-map-manager.ts to ensure that Leaflet plugins extend the correct Leaflet instance. This change addresses issues with plugin initialization due to the way CommonJS handles module imports.

Import order and plugin initialization:

  • Changed the import order so that 'leaflet' and 'leaflet.markercluster' are imported before importing all of Leaflet as L, ensuring plugins extend the correct Leaflet instance and preventing issues caused by module snapshotting in CommonJS.

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for iotmapcomponent ready!

Name Link
🔨 Latest commit 3c9754c
🔍 Latest deploy log https://app.netlify.com/projects/iotmapcomponent/deploys/6ad61e350b1ded8b1bfbe165
😎 Deploy Preview https://deploy-preview-504--iotmapcomponent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

The CommonJS output copies Leaflet into `L` with __importStar, so
members added afterwards by leaflet.markercluster were missing and
L.markerClusterGroup was not a function. Import Leaflet and the plugin
before `import * as L` so the copy includes the plugin.
@sebnic
sebnic force-pushed the fix/markercluster-leaflet-import-order branch from 0474cc8 to 3c9754c Compare October 19, 2026 13:42
@louismaximepiton
louismaximepiton requested a balanced review from Copilot October 21, 2026 10:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused import-order fix addresses plugin initialization with no blocking issues identified.

No open issues 🎉

What changed in this PR

Fixes Leaflet plugin initialization by loading markercluster before creating the CommonJS Leaflet namespace.

Changes:

  • Reorders imports so markercluster extends Leaflet before L is imported.
  • Documents why the import order matters.
File Description
src/​iotMapManager/​src/​iot-map-manager.ts Reorders Leaflet imports and explains the CommonJS requirement.

Review effort: Balanced

@louismaximepiton
louismaximepiton merged commit a0193d4 into Orange-OpenSource:main Oct 21, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants