-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(site): convert OrganizationAutocomplete to a fully controlled component #1440
Copy link
Copy link
Open
Description
Context
OrganizationAutocomplete currently manages its own selected state internally and exposes an onChange callback. PR coder/coder#23906 added an organizationId prop with render-time derivation to support controlled pre-selection, but the component is still a hybrid controlled/uncontrolled component.
Every other autocomplete/select component in the codebase (Autocomplete, UserAutocomplete, SelectFilter, MultiUserSelect) is fully controlled: the parent owns the value, and the component just renders and calls onChange.
Proposal
Refactor OrganizationAutocomplete to match the fully controlled pattern:
- Accept
value: Organization | nullandonChangefrom the parent - Remove internal
selectedstate entirely - Move the auto-select-single-org logic to callers (or a shared hook)
- Update both callers (
CreateUserForm,CreateTemplateForm) and all stories
This aligns the component with established codebase patterns and eliminates the remaining hybrid state complexity.
References
- PR github.com/feat(site): add organizationId prop to OrganizationAutocomplete coder#23906 (adds
organizationIdprop with render-time derivation)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels