Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(web): a provider status push no longer re-renders every provider card and model row #20851

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/20851/headmerged by juliusmarminge View on GitHub

Showing 11 changed files with 13 additions and 8 deletions (loading 10).

x
0 of 11 viewed, 11 left
13 additions and 8 deletionsapps/web/src/components/settings/ProviderInstanceCard.tsxModified
View file
@@ -39,6 +39,7 @@
} from "@t3tools/shared/model";
import { cn } from "../../lib/utils";
import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
+import { useStableCallback } from "../../hooks/useStableCallback";
import { normalizeProviderAccentColor } from "../../providerInstances";
import { Badge } from "../ui/badge";
import { Button } from "../ui/button";
@@ -131,11 +132,6 @@
​
-function readConfigCustomModels(config: unknown): ReadonlyArray<CustomModelDefinition> {
- if (config === null || typeof config !== "object") return [];
- return readCustomModelEntries((config as Record<string, unknown>).customModels);
-}
-​
function readConfigString(config: unknown, key: string): string | null {
if (config === null || typeof config !== "object") return null;
const value = (config as Record<string, unknown>)[key];
@@ -608,6 +604,7 @@
​
const EMPTY_ACP_PROJECTS: NonNullable<ProviderInstanceCardProps["acpProjects"]> = [];
+const NO_CUSTOM_MODELS: ReadonlyArray<CustomModelDefinition> = [];
​
/**
* Unknown drivers (`driverOption === undefined`) get a read-only