Problem
OrganizationAutocomplete declares its options prop as mutable Organization[]:
// site/src/components/OrganizationAutocomplete/OrganizationAutocomplete.tsx:24
options: Organization[];
useDashboard().organizations returns readonly Organization[]. Callers that pass this value must spread into a new array to satisfy the type:
options={[...organizations]}
This creates a new array identity every render, defeating React memoization for no reason. The component never mutates the array.
Fix
Change the prop type to readonly Organization[]:
- options: Organization[];
+ options: readonly Organization[];
Then remove the unnecessary spread in AgentCreateForm.tsx:382:
- options={[...organizations]}
+ options={organizations}
Context
Found during review of #23827 — the spread was flagged as unnecessary but turned out to be required by the current type signature.
🤖
Problem
OrganizationAutocompletedeclares itsoptionsprop as mutableOrganization[]:useDashboard().organizationsreturnsreadonly Organization[]. Callers that pass this value must spread into a new array to satisfy the type:This creates a new array identity every render, defeating React memoization for no reason. The component never mutates the array.
Fix
Change the prop type to
readonly Organization[]:Then remove the unnecessary spread in
AgentCreateForm.tsx:382:Context
Found during review of #23827 — the spread was flagged as unnecessary but turned out to be required by the current type signature.