Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use render() in main only once #144

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions streamlit_folium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading