@@ -113,12 +113,6 @@ interface ProviderModelsSectionProps {
113113 readonly onModelOrderChange : ( next : ReadonlyArray < string > ) => void ;
114114}
115115
116- /** CustomModelEditor keys its option list on this array. */
117- function useBuiltInModels ( models : ReadonlyArray < ServerProviderModel > ) {
118- "use memo" ;
119- return models . filter ( ( model ) => ! model . isCustom ) ;
120- }
121-
122116export function ProviderModelsSection ( {
123117 instanceId,
124118 driverKind,
@@ -153,9 +147,6 @@ export function ProviderModelsSection({
153147 const hiddenCount = displayModels . filter (
154148 ( model ) => ! model . isCustom && hiddenModelSet . has ( model . slug ) ,
155149 ) . length ;
156- const builtInModels = useBuiltInModels ( models ) ;
157- const allBuiltInModelsHidden =
158- builtInModels . length > 0 && builtInModels . every ( ( model ) => hiddenModelSet . has ( model . slug ) ) ;
159150 const showFilter = models . length > FILTER_THRESHOLD ;
160151 const normalizedFilter = filter . trim ( ) . toLowerCase ( ) ;
161152 const isFiltering = showFilter && normalizedFilter . length > 0 ;
@@ -179,6 +170,12 @@ export function ProviderModelsSection({
179170 row . scrollIntoView ( { block : "nearest" } ) ;
180171 } ) ;
181172
173+ // CustomModelEditor keys its option list on this array. Derived after the effect and
174+ // checked against `hiddenModels` rather than the set built above it, so it stays cached.
175+ const builtInModels = models . filter ( ( model ) => ! model . isCustom ) ;
176+ const allBuiltInModelsHidden =
177+ builtInModels . length > 0 && builtInModels . every ( ( model ) => hiddenModels . includes ( model . slug ) ) ;
178+
182179 const handleAdd = ( ) => {
183180 if ( ! canManageCustomModels || driverKind === "antigravity" ) return ;
184181 const normalized = normalizeCustomModelSlug ( input ) ;
0 commit comments