[Bug] Crash in filterGraphicsByDatum when setHovered receives datums from multiple series (out-of-bounds access on collection marks)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 221
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 26
Description
Version
2.1.6 (reproduced source-wise; originally found on 2.0.0)
Link to Minimal Reproduction
https://gist.github.com/CrazyBucket/0b6018dd186c1921ba85165c1bbf177b
Steps to Reproduce
- Open the reproduction link.
- The chart is rendered successfully.
setHoveredis called with a datum array that contains more items than the target mark's internal datum array.- Observe the runtime error in the console:
Current Behavior
TypeError: Cannot read properties of undefined (reading 'time')
at index.min.js:15:1476662
at Array.every ()
at index.min.js:15:1476642
at Array.every ()
at index.min.js:15:1476626
at Array.filter ()
at index.min.js:15:1476588
at Array.forEach ()
at index.min.js:15:1476478
at Array.forEach ()
Expected Behavior
setHovered should handle unmatched datum gracefully.
Possible expected behaviors:
- ignore datum that cannot be matched
- return without throwing an exception
A user-facing runtime crash should not happen.
Environment
- **OS**: macOS, iOS
- **Browser**: Chromium 139.0.7258.128, Safari (iOS WebKit)
- **Framework**: React
- **VChart Version**: 2.0.0, 2.1.6
Any additional comments?
Background / How we hit this
We use a multi-series health trend chart (blood pressure: systolic & diastolic) and implement cross-series highlighting via setHovered.
When the user touches the chart, we pass one datum per series at the hovered x position:
vchart.setHovered([systolicDatum, diastolicDatum])
I would be happy to submit a PR to fix this issue if the maintainers agree with the proposed direction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the setHovered entry point and trace into filterGraphicsByDatum, using the linked minimal reproduction to reproduce the out-of-bounds access. Verify behavior when the datum array contains items from multiple series, then confirm that unmatched datums are handled without a runtime exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100