refactor(events): remove event.selections and read state.selections - #115
Merged
Merged
Conversation
jvdd
force-pushed
the
refactor/event-selections-from-state
branch
from
September 29, 2026 07:56
2f3a3b3 to
e3a5194
Compare
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.
Closes #86.
Change
InteractionEventno longer hasselections./dashboard/updatepassesspec.state.selectionstoFlexEngine.process, which takes them as a newselectionsparameter (next toviewports_by_figure, the same order asbuild_cubes). Both entry points type itSequence[SelectionState]._active_selectionsstill returns[]forinitanddeselect. The server cache and the layer policy treatdeselectas unfiltered.selectionsany more.postDashboardUpdatecapturesDASHBOARD_SPEC.state.selectionsin the same synchronous step that serializes the spec, and applies the response with that list (isUnfilteredBaseForFigure)._fvFigureCacheEligibleandfvEnsureOverlayBackgroundread the state.postDashboardUpdateis the one place that picksselectionordeselect. Callers that report a selection change sendselection; it goes out asdeselectwhen the state it serializes has no selections. Before, five callers computedlist.length ? 'selection' : 'deselect'themselves.fvOnDeselectstill sendsdeselect.0.6→0.7(spec.py, and the example in the packagedflexviz-exploreskill). One bump for the breaking changes of this release: unknowncolor_scalenames raise (fix(heatmap): resolve color_scale to the plotly.js built-in names so the default draws viridis #111), two heatmaps and acorr_heatmapcolor_normare refused (refactor(figure): allow at most one heatmap trace per figure #112, fix(server): validate decoded specs at /view, /h and /share #114), a stored log viewport is in data units (fix(adapters): keep log axis viewports in data units #113), and the event format (refactor(events): remove event.selections and read state.selections #115).Architecture.md: the event fields and the engine signature.Impact
state.selectionsandevent.selections.await. If the user changed the selections during thatawait, the old code filtered by the stale list while the spec carried the new one. Now the server filters by the state it receives.event.selectionsgets no error. The server ignores the field (the model does not forbid extra fields). A spec of version0.6is refused, as for every other version change.Tests
test_state_selections_filter_the_request(tests/test_integration.py): a request withoutevent.selectionsis filtered bystate.selections, and a staleevent.selectionsis ignored. Both cases fail onmain.test_remove_selection_posts_type_matching_state[plotly|echarts](tests/test_browser.py): removing one of two selections postsselectionwith one left; removing the last postsdeselectwithstate.selections == []. It passes before and after the refactor.test_bar_deselect_clears_filternow sends the deselect with a selection still in the state, so thedeselectguard is tested.[]instead ofstate.selections, 25 tests fail.pytest tests flexviz_polars/tests: 2427 passed, 2 skipped.pytest benchmarks: 31 passed.pytest -m browser tests: 341 passed, 15 skipped (before the last commit, which splits oneifline and removes a source-text test). Local browser runs afterwards were unstable with page-load timeouts onmaintoo; CI is the reference.