Repository navigation
Description
Summary
In update mode, a figure with its own selection (an "owner") keeps its data when the selection of another figure changes. This saves round trips on cached sources. The cost: an owner can show data for an old version of the other selections. This issue describes the trade-off and the options to change it.
Decision (2026-09-25): keep the current behavior for now.
Current behavior
Three figures A, B, C on one source, update mode. Brush A (A1), brush B, then change A to A2:
| A | B | C | |
|---|---|---|---|
| After B brushes | all rows | rows in A1 | rows in A1 and B |
| After A changes | all rows | rows in A1 (old) | rows in A2 and B |
Two rules on main give this result:
- The engine does not recompute an owner on a
selectionevent (_should_process_traceinflexviz/engine.py). - Cube targets skip owners (
build_cubesinflexviz/engine.py,_fvCubeEnumerateTargetsinflexviz/adapters/js/plotly/events.js). When the cube serves every target, the commit sends no request.
The cube path and the request path give the same data. tests/test_integration.py::test_two_step_selection_excludes_both and the cube browser tests (the expected B uses expr_a_old) pin this behavior.
Engine-level reproduction: three lines on ts, A brushes 100..500, B brushes 200..400, then B changes to 300..350.
ev = InteractionEvent(type="selection", force_update=True,
selections=[sel("A", 100, 500), sel("B", 300, 350)])
# deltas: A -> none (keeps rows 200..400), B -> none, C -> (300, 350)Here the brush of B changes, so A is the owner with old data.
What it saves
The extra round trip exists only on sources registered with cache=True, when the cube serves every target of a commit. Cubes are opt-in (_run_cube_path in flexviz/server.py). On other sources, every commit already sends a request. There, a refresh of the owners costs only server work in that same request: one more aggregation per owner.
Where the current behavior is not consistent
For one state, B can show three versions:
- Live: filtered by A1, the old selection.
- After a zoom or pan on B (also a linked zoom): filtered by A2. The
viewportevent recomputes B with every other selection. - After a restore (shared URL, import,
flexvizApply): unfiltered. Theinitrequest drops all selections, and the nextselectionrequest skips owners (restoreDashboardFromSpecinflexviz/adapters/js/runtime/overlay.js).
A switch from overlay mode back to update mode shows the unfiltered or the old version, depending on history. So a shared URL, a zoom and the live view each show B differently.
Example of the mode switch: brush two figures, zoom the first, then switch to overlay mode and back. The zoomed figure now shows unfiltered data, although no selection changed. Two paths write unfiltered data into its base layer in overlay mode: the warm-up init, and a zoom on the figure. The selection request back to update mode then skips the figure. On main this happens when at least one figure has no selection. After #94 it also happens when every figure has a selection. Option A+ fixes it, because the switch back then refreshes the owners.
Options
| Option | Requests compared with main |
What B shows | Size |
|---|---|---|---|
A. Keep main, document it |
Same | The three versions above | Docs only |
A+. Keep main, make every catch-up the same |
Same | Old while live. Current after a zoom, pan, restore or mode switch | One bool field, one engine condition, two client calls |
| B. Refresh owners on every commit (#93) | +1 per commit on cached sources | Always current, after you release the mouse | Done in #93 |
| B'. B, and the commit request recomputes only owners | Same as B | Same as B | About 15-20 lines, one event field |
| C. Owner cube targets (the Mosaic and Falcon design) | Same, for traces that can use a cube | Always current, also during the drag | About 40-60 production lines and 150-250 test lines (estimate) |
| D. Refresh owners only when a request goes out anyway | Same | Current, except after a commit that the cube served | #93 without the forced request |
A. Keep main, document it. No code change. The rule stays hard to state, because the three versions above stay.
A+. Keep main, make every catch-up the same. Owners still keep their data when another selection changes. But every time an owner catches up, all other selections apply. Restore and the switch to update mode then do what a zoom already does. The rule becomes one sentence: "A figure with a selection does not follow other selections live. It catches up when you zoom or pan it, reload, or switch mode." Implementation:
- One bool on
InteractionEvent(for examplerefresh_owners) and one condition in_should_process_trace. - The client sets it on the second request of
restoreDashboardFromSpecand on the mode switch infvOnCfMode. - No extra requests. Only those rare requests do more work.
- Optional: an "out of date" mark on the owner panel. A click refreshes the figure through the zoom path, so it costs a request only when the user asks.
B. Refresh owners on every commit (#93). Correct and simple. On a cached source, a commit that the cube served sends one request when another figure has a selection. That request also recomputes the targets that the cube already drew. Owners update when you release the mouse, not during the drag. Pie and treemap clicks do not use the cube in that case.
B'. B, and the commit request recomputes only owners. Same number of requests as B, less server work. It needs one event field, for example a list of figures to recompute.
C. Owner cube targets. Each owner becomes a cube target with its own passive key: every selection except the one of the brushed figure and its own. Owners then update live during the drag, and a commit that the cube served sends no request. With no owners, nothing changes: same targets, same keys, same scans. C builds on the engine rule of #93. Costs and risks:
- At brush start, the server builds one more cube per owner trace, one scan each. The live preview waits for every capable target. After that the cubes are cached. Not measured.
- Owner traces that cannot use a cube still send a request on commit: box plots, median or
n_uniquebars, zoomed hist2d, and nth, lttb and minmax lines. - A categorical bar owner redraws on every frame and can emit its own selection again. This needs a browser test.
D. Refresh owners only when a request goes out anyway. No extra requests. But whether B follows A then depends on a cache hit, which users cannot predict. Not recommended.
Rejected models:
- Ordered drill-down. An owner follows only the selections made before it, and only the latest brush stays editable. No tool that we checked works this way.
- Owners always unfiltered, as in overlay mode. B's bars change under the brush that you just drew, and B loses the context of A.
- Store the filter context of each owner in the spec. The spec grows, and B can stay filtered by a selection that no longer exists.
Prior art
No tool that we checked keeps owners out of date on purpose.
- crossfilter.js and dc.js. A group ignores only the filter of its own dimension. Every chart redraws on every filter change. This is all in memory, so it costs nothing.
- Mosaic.
Selection.crossfilter()gives each client all clauses except its own.PreAggregatorbuilds one pre-aggregated table per client and active clause, filtered byselection.remove(source).predicate(client). A client with its own brush gets its own table (option C). - Falcon. While one view is active, every other view updates from its prefetched cube, also a view with its own brush (
src/app.ts,update1DActiveView). - Superset (fix(cross-filters): Make chart emitting cross-filter exclude itself from filtering apache/superset#14046). The chart that emits a cross-filter excludes only itself. Every other chart is queried again, also one with its own cross-filter.
Status
- fix: let a figure with its own selection follow the selections of other figures #93 implements option B. It stays open as a reference and is not merged.
- The two overlay-background bugs that fix: let a figure with its own selection follow the selections of other figures #93 found also exist on
main. Their fixes move to fix(adapters): keep the overlay background correct after a zoom or panel reset under a cross-filter #94. - Suggested order if this comes back: A+ first (no extra requests, one rule for every catch-up). Then C when a user reports old data in an owner. Measure the brush-start cost of C before it lands.
Activity
[-]A figure that owns a brush keeps stale data when another figure's brush changes (update mode)[/-][+]Update mode: a figure with its own selection does not follow other selections live (trade-off)[/+]