Commit 3aa253c
Guard CustomOption scrollIntoView against null ref (#2832)
When a Select closes while a useEffect scroll-to-selected-option is
pending (e.g. concurrent rendering or rapid open/close), React sets
ref.current to null during Option unmount before the effect fires.
The `props.isSelected && ref.current.scrollIntoView()` call then throws
TypeError: Cannot read properties of null (reading 'scrollIntoView').
Using optional chaining (ref.current?.scrollIntoView()) makes the call
a no-op when the component has already unmounted.
Fixes neetozone/neeto-cal-web#23714
Co-authored-by: Neeto Dev Bot <agent@neeto-dev-bot.neetozone.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 9d0cf3c commit 3aa253c
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments