Skip to content

Commit 52cb2b0

Browse files
authored
fix-mlhexagonlayer-mlgeojsonlayer (#267)
authored-by: jannik brack <jannik.brack@wheregroup.com>
1 parent 4cacc4a commit 52cb2b0

2 files changed

Lines changed: 14 additions & 21 deletions

File tree

packages/deck-gl/src/components/MlHexagonLayer/MlHexagonLayer.tsx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,31 @@ const defaultProps = {
4040
const MlHexagonLayer = (props: MlHexagonMapProps) => {
4141
const deckGlHook = useDeckGl();
4242

43-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
44-
// @ts-expect-error
45-
props = {
46-
...defaultProps,
47-
...props,
48-
};
49-
50-
const { mapId, ...HexagonLayerProps } = props;
51-
5243
const mapHook = useMap({
53-
mapId: mapId,
54-
waitForLayer: HexagonLayerProps.beforeId,
44+
mapId: props.mapId,
45+
waitForLayer: props.beforeId,
5546
});
5647

5748
// create deck.gl HexagonLayer once when its props change
5849
const hexagonLayer = useMemo(() => {
50+
const { mapId: _mapId, ...HexagonLayerProps } = props;
5951
if (!HexagonLayerProps.data) return null;
6052
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6153
// @ts-ignore
6254
return new HexagonLayer({
55+
...defaultProps,
6356
...HexagonLayerProps,
6457
} as unknown as HexagonLayerProps);
6558
}, [
66-
HexagonLayerProps.beforeId,
67-
HexagonLayerProps.data,
68-
HexagonLayerProps.elevationScale,
69-
HexagonLayerProps.extruded,
70-
HexagonLayerProps.coverage,
71-
HexagonLayerProps.autoHighlight,
72-
HexagonLayerProps.material,
73-
HexagonLayerProps.radius,
74-
HexagonLayerProps.transitions,
59+
props.beforeId,
60+
props.data,
61+
props.elevationScale,
62+
props.extruded,
63+
props.coverage,
64+
props.autoHighlight,
65+
props.material,
66+
props.radius,
67+
props.transitions,
7568
]);
7669

7770
// add/remove the memoized layer

packages/react-maplibre/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ const catalogueTemplate = (context: any) => {
444444
}
445445
/>
446446

447-
{selectedLayer === 'circle' && <CircleTemplate geojson={context.args.geojson} />}
447+
{selectedLayer === 'circle' && <CircleTemplate geojson={context.geojson} />}
448448
{selectedLayer === 'line' && (
449449
<LineStyler
450450
openSidebar={openSidebar}

0 commit comments

Comments
 (0)