Repository navigation
fix(adapters): keep the newest figure data when responses arrive out of order - #89
Conversation
…s while their response is pending
…sponse order tests
…ecause clicks cancel the drill
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Existing guard assertions will fail, and cache and overlay extent updates remain vulnerable to stale responses.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR protects figure updates from out-of-order responses, preserves zooms during reset/deselect operations, and scopes Plotly guards per figure.
Changes:
- Added sequence-aware writes and request-time cache keys.
- Updated reset/deselect and programmatic-operation guard behavior.
- Added browser coverage and updated architecture documentation.
| File | Description |
|---|---|
tests/test_html_adapters.py |
Contains adapter assertions for guard behavior and treemap changes. |
tests/test_browser.py |
Adds response-ordering, guard, cache, and zoom regression tests. |
flexviz/adapters/js/runtime/state.js |
Removes obsolete treemap state. |
flexviz/adapters/js/runtime/overlay.js |
Handles runtime overlay cache resets. |
flexviz/adapters/js/runtime/delta.js |
Applies sequence-aware response writes. |
flexviz/adapters/js/runtime/cache.js |
Captures cache keys at request time. |
flexviz/adapters/js/plotly/traces.js |
Updates Plotly trace and guard behavior. |
flexviz/adapters/js/plotly/render.js |
Implements per-figure operation tracking. |
flexviz/adapters/js/plotly/init.js |
Avoids holding guards during reset/deselect requests. |
flexviz/adapters/js/plotly/events.js |
Uses scoped guards and sequenced client writes. |
Architecture.md |
Documents sequencing and guard behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| function handleRelayout(relayout, figUid) { | ||
| if (!relayout) return; | ||
| if (_programmaticOp) return; | ||
| if (_fvIsProgrammatic(figUid)) return; |
There was a problem hiding this comment.
These tests do not fail: _programmaticOp is a substring of _programmaticOps, so all three pass locally and in CI. But this shows that they only searched the whole page HTML and would pass without any guard. Fixed in db6b677: the deselect and relayout tests now check _fvIsProgrammatic(figUid) inside the handleDeselect and handleRelayout bodies (both fail when the guard is removed). test_reset_deletes_axis_range is deleted. It required the reset to use the guard, which is the opposite of the #85 fix. The browser test test_a_zoom_while_a_reset_is_pending_posts_and_keeps_its_data covers reset now.
…relayout handlers
|
Reply to the two stale-response points in the Copilot review overview: Cache updates. Not reachable. The cache key is fixed ( Overlay y-extent ( |

Fixes #75, #76 and #85. The browser now keeps the newest figure data when responses arrive out of order. The reset and deselect buttons no longer drop zooms while their response is pending.
Changes
fvSaveLayerData,fvSaveHasBackground). A response to a request sent before the brush then still applies when it lands after the abort.d: nulland the new key hasd: [20, 60].Plotly.reactemits no relayout, so the guard is not necessary there. When it was held, it dropped the user's zooms.fvRunProgrammaticPlotlyOp(figUid, op)), kept inrender.jsnext to that function. Operations that overlap no longer release each other's guard. A heatmap overlay colorbar restyle no longer blocks events in other figures.fvCacheGetreads with that key. Before this change, a deselect sent while zoomed was cached as unfiltered if an autorange happened before its response arrived.handleClickreturnsfalseon every path, which cancels Plotly's native drill, so the treemap always stays at its root level. The reset did nothing. The unused fallback aroundfvRunProgrammaticPlotlyOpintraces.jsis also removed.Architecture.mdis updated for the write numbers, the abort restore, the per-figure guard and the treemap drill.CHANGELOG.mdhas three new entries under Fixed.Known limitations
bgYExtentByFig) is not protected by the write numbers. Only the deprecated ECharts renderer reads it.mainbehaves the same. Tracked in An abandoned live brush loses a response that landed during the brush #92.Tests
tests/test_html_adapters.pyare replaced by these browser tests.