Repository navigation
feat(s2): reset interaction state on data updates and rebuilds - #1098
Open
madelineluke wants to merge 1 commit into
Open
madelineluke wants to merge 1 commit into
madelineluke wants to merge 1 commit into
Conversation
Data updates and rebuilds close open popovers, clear the selection, reset hover and tooltips, and prune hidden legend series that no longer exist. Discrete domains and legend entries keep first-appearance order so restored series and categories return to their original position. Fixes #1082 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #1082
Stacked on #1080. Retarget to
mainafter #1080 merges.What changes for consumers
Following the chart stability RFC:
main.How
onInteractionResetcallback. It also calls the callback after a rebuild.useInteractionReset: closes registered dialogs (popovers and the lab action bar), clearsselectedData, hides the tooltip, and prunes uncontrolled hidden series using the legend entry scales.min(rscMarkId).min(rscMarkId)and is sorted, so legend entries line up with the domain.Behavior to be aware of
hiddenSeriesprop is never pruned; that's the consumer's to manage.rscMarkId) are reassigned on every data update, so selection can't survive one. A possible follow-up: keep the selection when the row still exists, keyed byidKey. That would diverge from the RFC.Testing
Chart.interactionRetention.test.tsx: the keep/reset matrix for popover, selection, hover, tooltip and hidden series.Chart.stability.test.tsx: restored series and bar category order.test.failmarkers for data updates and rebuilds frombrowser/interactionRetention.test.ts. The SVG cases pass. Canvas screenshot diffs are text antialiasing;mainshows similar flakiness.