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)