From fb0132d8505f36606c28631b0917f1c30ca8be20 Mon Sep 17 00:00:00 2001 From: Bastien GAUTHIER Date: Fri, 29 Sep 2023 15:11:58 +0200 Subject: [PATCH] Use render() in main Removed in _get_map_string and _get_siblings --- streamlit_folium/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/streamlit_folium/__init__.py b/streamlit_folium/__init__.py index 930af60..5663e0f 100644 --- a/streamlit_folium/__init__.py +++ b/streamlit_folium/__init__.py @@ -105,7 +105,6 @@ def folium_static( def _get_siblings(fig: folium.MacroElement) -> str: """Get the html for any siblings of the map""" - fig.render() children = list(fig.get_root()._children.values()) html = "" @@ -127,8 +126,6 @@ def get_full_id(m: folium.MacroElement) -> str: def _get_map_string(fig: folium.Map) -> str: - fig.render() - leaflet = generate_leaflet_string(fig) # Get rid of the annoying popup @@ -243,6 +240,8 @@ def st_folium( if not (isinstance(fig, folium.Map) or isinstance(fig, folium.plugins.DualMap)): folium_map = list(fig._children.values())[0] + folium_map.render() + leaflet = _get_map_string(folium_map) # type: ignore html = _get_siblings(folium_map)