From 658466c285d0b6716c61e8812db4292136f1a046 Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Wed, 6 Jul 2022 16:21:45 -0400 Subject: [PATCH] Fix all_drawings to get properly populated (#76) * Fix all_drawings to get properly populated * Remove debugger * Remove unused variable --- streamlit_folium/frontend/src/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/streamlit_folium/frontend/src/index.tsx b/streamlit_folium/frontend/src/index.tsx index d885756..6b24604 100644 --- a/streamlit_folium/frontend/src/index.tsx +++ b/streamlit_folium/frontend/src/index.tsx @@ -8,7 +8,6 @@ type GlobalData = { last_active_drawing: any all_drawings: any zoom: any - drawn_items: any last_circle_radius: number | null last_circle_polygon: any } @@ -18,6 +17,7 @@ declare global { __GLOBAL_DATA__: GlobalData initComponent: any map: any + drawnItems: any } } @@ -73,8 +73,8 @@ function onLayerClick(e: any) { if (e.layer && e.layer.toGeoJSON) { global_data.last_active_drawing = e.layer.toGeoJSON() } - if (global_data.drawn_items.toGeoJSON) { - details = global_data.drawn_items.toGeoJSON().features + if (window.drawnItems.toGeoJSON) { + details = window.drawnItems.toGeoJSON().features } global_data.all_drawings = details debouncedUpdateComponentValue(window.map) @@ -140,7 +140,6 @@ function onRender(event: Event): void { all_drawings: null, last_active_drawing: null, zoom: null, - drawn_items: [], last_circle_radius: null, last_circle_polygon: null, }