fix: guard collection-mark matching in filterGraphicsByDatum - #4693
Merged
xile611 merged 3 commits intoSep 20, 2026
Conversation
Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
This was referenced Sep 20, 2026
xile611
approved these changes
Sep 20, 2026
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 #4678
🤔 This is a ...
🔗 Related issue link
Fixes #4678
💡 Background and solution
setHoveredwith datums from multiple series (or any hovered list longer than a collection mark's internal datum array) crashed infilterGraphicsByDatum.In the
isCollectionMarkbranch, the match predicate did:When
elDatum[index]was missing, readingelDatum[index][k]threw (Cannot read properties of undefined).This change short-circuits when
elDatum[index]is absent, so unmatched datums are ignored and no exception is thrown. Non-collection matching is unchanged, so point graphics that do match still highlight.Repro from the issue gist: a line chart plus
setHovered([...data, extraUnmatchedDatum])no longer throws.📝 Changelog
filterGraphicsByDatum, sosetHoveredwith a longer multi-series datum list does not throwfilterGraphicsByDatum在集合图元匹配时忽略越界/未匹配 datum,避免多系列setHovered抛错☑️ Self-Check before Merge
Verification
eslint --quietonpackages/vchart/src/chart/base/base-chart.tsand the new test: cleanjest __tests__/unit/chart/filter-graphics-by-datum.test.ts --runner=jest-runner --testEnvironment=node: 3 passedjest-electronrunner hung in this Linux environment (CI uses macos-latest); the node runner is enough for this non-render regression.Manual repro (if needed)
vchart.setHovered([...data, { time: '20:00', value: 12 }])setHovered([systolicDatum, diastolicDatum])should highlight matched point graphics and skip collection marks whose internal datum array is shorter