Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions apps/web/src/components/settings/ProviderModelsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ interface ProviderModelsSectionProps {
readonly onModelOrderChange: (next: ReadonlyArray<string>) => void;
}

/** CustomModelEditor keys its option list on this array. */
function useBuiltInModels(models: ReadonlyArray<ServerProviderModel>) {
"use memo";
return models.filter((model) => !model.isCustom);
}

export function ProviderModelsSection({
instanceId,
driverKind,
Expand Down Expand Up @@ -153,9 +147,6 @@ export function ProviderModelsSection({
const hiddenCount = displayModels.filter(
(model) => !model.isCustom && hiddenModelSet.has(model.slug),
).length;
const builtInModels = useBuiltInModels(models);
const allBuiltInModelsHidden =
builtInModels.length > 0 && builtInModels.every((model) => hiddenModelSet.has(model.slug));
const showFilter = models.length > FILTER_THRESHOLD;
const normalizedFilter = filter.trim().toLowerCase();
const isFiltering = showFilter && normalizedFilter.length > 0;
Expand All @@ -179,6 +170,12 @@ export function ProviderModelsSection({
row.scrollIntoView({ block: "nearest" });
});

// CustomModelEditor keys its option list on this array. Derived after the effect and
// checked against `hiddenModels` rather than the set built above it, so it stays cached.
const builtInModels = models.filter((model) => !model.isCustom);
const allBuiltInModelsHidden =
builtInModels.length > 0 && builtInModels.every((model) => hiddenModels.includes(model.slug));

const handleAdd = () => {
if (!canManageCustomModels || driverKind === "antigravity") return;
const normalized = normalizeCustomModelSlug(input);
Expand Down
Loading