Fix issue #215: stabilize heavy ipyleaflet rerenders#229
Draft
Fix issue #215: stabilize heavy ipyleaflet rerenders#229
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ipyleafletrerenders by opening child widget models before opening the parent widget model#215Playwright regression to use aLayerGroupwith 1,000CircleMarkers so it matches the reported heavy-map failure modeProblem
Issue
#215reports that rerendering anipyleafletmap with many points can leave the map gray or unusable.The failure mode here is that a parent widget view can start rendering before the browser knows about all child widget models referenced by that parent state. In
ipyleaflet, that shows up as child-view creation failures and incomplete map rendering when a map has many layers.Fix
This change keeps the existing delayed-open behavior for widget initialization, but narrows the ordering fix to one specific rule on the Python side:
That preserves child-before-parent availability during initial render and rerender while keeping the browser-side code unchanged.
Evidence
I re-ran this from a clean
origin/mainworktree to make sure the final version still has a real red/green story.Baseline with only the new heavy
#215repro applied:tests/playwright/ipyleaflet_rerender_cleanup -vvfails onorigin/mainpath.leaflet-interactiveelements ever appear within the 30s timeoutThen, applying only the
_shinywidgets.pychange from this branch on top of that clean baseline:tests/playwright/ipyleaflet_rerender_cleanup -vvpassestests/playwright/ipyleaflet_marker_click -vvpassestests/playwright/plotly_rerender_cleanup -vvpassestests/playwright/altair_rerender_cleanup -vvpassestests/playwright/bokeh_rerender_cleanup -vvpassesThat makes the current confidence story much stronger than the earlier exploratory versions of this branch: the heavy repro is red on baseline, and it turns green with this narrower Python-side fix alone.
Verification
Verified locally on this branch with:
yarn build./.venv/bin/python -m pytest -c tests/playwright/playwright-pytest.ini tests/playwright/ipyleaflet_marker_click -vv./.venv/bin/python -m pytest -c tests/playwright/playwright-pytest.ini tests/playwright/ipyleaflet_rerender_cleanup -vv./.venv/bin/python -m pytest -c tests/playwright/playwright-pytest.ini tests/playwright/plotly_rerender_cleanup -vv./.venv/bin/python -m pytest -c tests/playwright/playwright-pytest.ini tests/playwright/altair_rerender_cleanup -vv./.venv/bin/python -m pytest -c tests/playwright/playwright-pytest.ini tests/playwright/bokeh_rerender_cleanup -vv