Fix duplicate HTML when map.save() is called repeatedly#2239
Conversation
14e8de6 to
9707f4a
Compare
Repeated save() calls appended duplicate JavaScript because SetIcon and ElementAddToElement created new render children with unique IDs on each pass. Use stable script names so repeated renders replace instead of append. Do not clear figure.html in render(); geopandas adds legend HTML directly there. Fixes python-visualization#2237
9707f4a to
2b7290a
Compare
|
neuroslope |
|
Seems like a sensible change. I do not understand everything yet. Why is the |
|
Adding But I have no idea why UPD: all other changes, except those two above mentioned functions are irrelevant |
Keep only ElementAddToElement.render() and Marker.SetIcon.render() per review feedback.
|
The default path uses a new random script name each render, the overrides use deterministic names tied to the element or marker, so repeated save() updates the same script slot instead of duplicating it. |
|
Running the automated tests now. |
|
Publish Docs fails on an external WMS timeout in WmsTimeDimension.md, issue is not from this PR? |
Correct. Will merge. |
Summary
SetIconandElementAddToElementso repeatedsave()calls replace JavaScript instead of appending duplicatesfigure.htmlduringrender()so geopandas legend HTML added directly to the figure is preservedsave()calls produce identical HTMLFixes #2237
Test plan
pytest tests/test_map.py::test_repeated_save_produces_identical_htmlpytest geopandas/tests/test_explore.pylegend tests (categorical legend, colorbar, mapclassify)pytest tests --ignore=tests/seleniumpre-commit runon changed files