Repository navigation
ref(select): decouple the public API from React Select - #128354
Conversation
Story previewsPreview the stories changed in this PR on the Vercel deployment:
Preview deployment: https://sentry-lpli4xg7q.sentry.dev |
…pi-cleanup # Conflicts: # static/app/components/core/form/field/selectField.tsx # static/app/components/core/select/types.tsx
Sentry Snapshot Testing
|
📊 Type Coverage Diff
🔍 19 new type safety issues introduced
...and 2 more Non-null assertions (
Type assertions (
This is informational only and does not block the PR. |
|
bugbot run |
Convert legacy choices at form boundaries and update standalone callers. Add coverage for the options contract, choice conversion, and creatable defaults.
| const NONE_SELECTED_LABEL = t('None selected'); | ||
|
|
||
| export interface SelectFieldProps<OptionType extends OptionTypeBase> | ||
| export interface SelectFieldProps<OptionType extends SelectValue<any>> |
There was a problem hiding this comment.
I will make the typings (any) better in a follow-up:
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e024103. Configure here.
| inputValue={inputValue} | ||
| onInputChange={handleInputChange} | ||
| onInputChange={setTypedText} | ||
| onBlur={handleBlur} |
There was a problem hiding this comment.
Typed path prefix silently lost on blur
High Severity
The onInputChange={setTypedText} handler receives ALL react-select input-change actions (including input-blur), which clears typedTextRef to '' before handleBlur runs. This means handleBlur always finds an empty ref and never commits the user's typed path prefix. Previously, blur was handled inside the onInputChange callback (checking action === 'input-blur'), which could read typedTextRef.current before it was cleared. The fix is to filter onInputChange by reason, only calling setTypedText when reason === 'input'.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit e024103. Configure here.
Migrates the legacy `Select` into `@sentry/scraps`. Unfortunately this means we have a dependency on `react-select`, but #128354 decoupled the API from this. Certainly not opposed to using the move as an excuse to drop the legacy dep, but opted for a direct move approach here. closes DE-1737


This PR changes the public API of our
Selectcomponent to de-couple it fromreact-select, which is used underneath but we plan to move away from it.isDisabled / disabled,isSearchable / searchableandisMulti / multi / multiple(yeah we had 3 props that do the same thing!)choices, we now always useoptionsclearableandmultipleare now discriminators that change the type ofvalueand for callbackscomponents, we now haverender...callbacks.closeMenuOnSelectvirtualizedprop