Skip to content

Commit 4947e42

Browse files
authored
Fix layer-click bug (#57)
1 parent cec74c5 commit 4947e42

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setuptools.setup(
44
name="streamlit_folium",
5-
version="0.6.8",
5+
version="0.6.9",
66
author="Randy Zwitch",
77
author_email="[email protected]",
88
description="Render Folium objects in Streamlit",

streamlit_folium/frontend/src/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ function onRender(event: Event): void {
6464
function onLayerClick(e: any) {
6565
const global_data = __GLOBAL_DATA__;
6666
global_data.last_object_clicked = e.latlng;
67+
let details: Array<any> = [];
6768
if (e.layer && e.layer.toGeoJSON) {
6869
global_data.last_active_drawing = e.layer.toGeoJSON();
6970
}
70-
let details: Array<any> = global_data.drawnItems.toGeoJSON().features;
71+
if (global_data.drawnItems.toGeoJSON) {
72+
details = global_data.drawnItems.toGeoJSON().features;
73+
}
7174
global_data.all_drawings = details;
7275
debouncedUpdateComponentValue()
7376
}

0 commit comments

Comments
 (0)