fix: in adaptEventHandlers check inputProps[key] before calling#6969
fix: in adaptEventHandlers check inputProps[key] before calling#6969ckifer merged 1 commit intorecharts:mainfrom
Conversation
Walkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
469f1c7 to
fde3870
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6969 +/- ##
=======================================
Coverage 90.38% 90.38%
=======================================
Files 515 515
Lines 38497 38497
Branches 5338 5338
=======================================
Hits 34797 34797
Misses 3691 3691
Partials 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
The fix adds a typeof inputProps[key] === 'function' guard to adaptEventHandlers (line 1140 in src/util/types.ts), matching the existing pattern in adaptEventsOfChild. Previously, when a
consumer passed onMouseEnter: undefined (or any non-function event prop), adaptEventHandlers would include it in the output object and later attempt to call undefined(...), throwing a TypeError. Now it
simply skips non-function event props.
On line 1141, adaptEventHandlers does:
out[key] = newHandler || ((e: Event) => inputProps[key](inputProps, e));
When no newHandler is provided and inputProps[key] is undefined (e.g. onMouseEnter: undefined), the fallback lambda calls undefined(inputProps, e) which throws. Meanwhile, adaptEventsOfChild correctly
guards with typeof item === 'function' on line 1170.
Related Issue
related issue: #6968
Motivation and Context
It solves the issue
How Has This Been Tested?
Screenshots (if appropriate):
Screen.Recording.2026-02-06.at.17.49.43.mov
Types of changes
Checklist:
Summary by CodeRabbit
Bug Fixes