Skip to content

Commit 58a19d1

Browse files
📦 Ensure the leaflet import is coordinated with react-leaflet-draw
react-leaflet-draw imports the default import (module), which gets mutated by the side-effects from leaflet-draw that adds leaflet.Draw. When using the 'import * as L' variant, L.Draw is not available as L and leaflet end up being different objects, breaking the SDK storybook/build. Using the default import seems to resolve this - hopefully there are no other cases where this causes issues (e.g. with other libraries...). The inlining of the formio-renderer in the SDK *may* have something to do with this, but frankly I don't understand bundlers, nor do I have a desire to understand the whole module resolution mechanics and side-effects bull$hit going on.
1 parent 9d2adb0 commit 58a19d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/map/LeafletMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {CoordinatePair, GeoJsonGeometry, MapComponentSchema} from '@open-formulieren/types';
2-
import * as L from 'leaflet';
2+
import L from 'leaflet';
33
import {useEffect, useId, useRef} from 'react';
44
import {useIntl} from 'react-intl';
55
import {FeatureGroup, MapContainer, TileLayer, useMap} from 'react-leaflet';

0 commit comments

Comments
 (0)