Skip to content

ref(select): decouple the public API from React Select - #128354

Merged
TkDodo merged 12 commits into
masterfrom
tkdodo/ref/select-api-cleanup
Oct 29, 2026
Merged

TkDodo merged 12 commits into
masterfrom
tkdodo/ref/select-api-cleanup

Conversation

@TkDodo

@TkDodo TkDodo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

This PR changes the public API of our Select component to de-couple it from react-select, which is used underneath but we plan to move away from it.

  • streamline duplicates, like isDisabled / disabled , isSearchable / searchable and isMulti / multi / multiple (yeah we had 3 props that do the same thing!)
  • removed choices, we now always use options
  • better types: clearable and multiple are now discriminators that change the type of value and for callbacks
  • removed AsyncSelect - fetching happens outside of select.
  • instead of components, we now have render... callbacks.
  • removed some things that were generally unused but exposed in types, like closeMenuOnSelect
  • virtualization is built in with the virtualized prop

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

…pi-cleanup

# Conflicts:
#	static/app/components/core/form/field/selectField.tsx
#	static/app/components/core/select/types.tsx
@sentry

sentry Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 772 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 95.82% 95.85% 🟢 +0.03%
Typed 142,252 142,314 🟢 +62
Untyped 6,200 6,169 🟢 -31
🔍 19 new type safety issues introduced

any-typed symbols (17 new)

File Line Detail
static/app/components/forms/fields/selectField.tsx 143 fieldProps (param)
static/app/components/forms/fields/selectField.tsx 145 id (var(binding))
static/app/components/forms/fields/selectField.tsx 146 onChange (var(binding))
static/app/components/forms/fields/selectField.tsx 147 onBlur (var(binding))
static/app/components/forms/fields/selectField.tsx 148 _required (var(binding))
static/app/components/forms/fields/selectField.tsx 149 _children (var(binding))
static/app/components/forms/fields/selectField.tsx 150 disabled (var(binding))
static/app/components/forms/fields/selectField.tsx 151 disabledReason (var(binding))
static/app/components/forms/fields/selectField.tsx 152 model (var(binding))
static/app/components/forms/fields/selectField.tsx 153 name (var(binding))
static/app/components/forms/fields/selectField.tsx 154 placeholder (var(binding))
static/app/components/forms/fields/selectField.tsx 155 choices (var(binding))
static/app/components/forms/fields/selectField.tsx 156 options (var(binding))
static/app/components/forms/fields/selectField.tsx 157 props (var(binding))
static/app/components/modals/inviteMembersModal/inviteRowControl.tsx 185 data (param(binding))

...and 2 more

Non-null assertions (!) (1 new)

File Line Detail
static/app/components/modals/inviteMembersModal/inviteRowControl.tsx 39 inviteStatus[option.value]!

Type assertions (as) (1 new)

File Line Detail
static/app/components/core/select/select.tsx 740 as OptionsType<OptionType> — displayOptions as OptionsType<OptionType>

This is informational only and does not block the PR.

@TkDodo

TkDodo commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous 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>>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make the typings (any) better in a follow-up:

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@TkDodo
TkDodo marked this pull request as ready for review October 29, 2026 09:10
@TkDodo
TkDodo requested review from a team as code owners October 29, 2026 09:10
@TkDodo
TkDodo merged commit 50ba0d4 into master Oct 29, 2026
83 checks passed
@TkDodo
TkDodo deleted the tkdodo/ref/select-api-cleanup branch October 29, 2026 09:11

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e024103. Configure here.

natemoo-re added a commit that referenced this pull request Nov 3, 2026
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 branch was successfully deployed

1 active deployment
Preview — e024103a Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants