Skip to content

Commit cc7aa08

Browse files
authored
deduplicate js_links (#272)
Adding multiple elements requiring plugin, e.g. PolyLineTextPath would add multiple duplicates of the same plugin link causing issues downstream (e.g. the layer control not working properly).
1 parent d6459ce commit cc7aa08

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

streamlit_folium/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ def walk(fig):
412412
css_links.extend([href for _, href in getattr(elem, "default_css", [])])
413413
js_links.extend([src for _, src in getattr(elem, "default_js", [])])
414414

415+
# deduplicate links
416+
css_links = list(dict.fromkeys(css_links))
417+
js_links = list(dict.fromkeys(js_links))
418+
415419
hash_key = generate_js_hash(leaflet, key, return_on_hover)
416420

417421
def _on_change():

0 commit comments

Comments
 (0)