Skip to content

Commit ca1e765

Browse files
committed
v3.2.5
1 parent 9f88d11 commit ca1e765

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v3.2.5 (2022-01-15)
2+
3+
Fix supporting mutable `whenCreated` with unmounting `MapContainer`.
4+
15
## v3.2.4 (2022-01-09)
26

37
Fix removing the map handlers when `MapContainer` is unmounted.

packages/react-leaflet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-leaflet",
3-
"version": "3.2.4",
3+
"version": "3.2.5",
44
"description": "React components for Leaflet maps",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",

packages/react-leaflet/src/MapContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ export function MapContainer<
7171
createdRef.current = true
7272
whenCreated(map)
7373
}
74+
}, [map, whenCreated])
7475

76+
useEffect(() => {
7577
return () => {
7678
map?.remove()
7779
}
78-
}, [map, whenCreated])
80+
}, [map])
7981

8082
const [props] = useState({ className, id, style })
8183
const context = useMemo(

0 commit comments

Comments
 (0)