From f65e38f3d14fa488187f89828f14d40a735a04e9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 12 Jun 2026 16:47:30 +0000 Subject: [PATCH] Remove provider environment sync effect Co-authored-by: Julius Marminge --- .../settings/ProviderInstanceCard.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsx index 823f8f968ad..f041333d232 100644 --- a/apps/web/src/components/settings/ProviderInstanceCard.tsx +++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx @@ -12,7 +12,7 @@ import { } from "lucide-react"; import * as Arr from "effect/Array"; import * as Result from "effect/Result"; -import { useEffect, useState, type ReactNode } from "react"; +import { useState, type ReactNode } from "react"; import { isProviderDriverKind, type ProviderInstanceConfig, @@ -77,6 +77,19 @@ function makeEnvironmentDraftRow( }; } +function getProviderEnvironmentSectionKey( + environment: ReadonlyArray, +): string { + return JSON.stringify( + environment.map((variable) => [ + variable.name, + variable.value, + variable.sensitive, + variable.valueRedacted ?? null, + ]), + ); +} + /** * Read a string[] at `key` from the opaque config blob, filtering out * non-string entries. Used for `customModels`, which is always typed as @@ -161,10 +174,6 @@ function ProviderEnvironmentSection(props: { props.environment.map(makeEnvironmentDraftRow), ); - useEffect(() => { - setRows(props.environment.map(makeEnvironmentDraftRow)); - }, [props.environment]); - const publishRows = (nextRows: ReadonlyArray) => { const published: ProviderInstanceEnvironmentVariable[] = []; for (const row of nextRows) { @@ -448,6 +457,8 @@ export function ProviderInstanceCard({ : null; const customModels = readConfigStringArray(instance.config, "customModels"); + const environment = instance.environment ?? []; + const environmentSectionKey = getProviderEnvironmentSectionKey(environment); // Server-returned models may lag behind settings writes. Treat probe // models as the source for built-ins only; custom rows come directly // from the current instance config so add/remove reflects immediately. @@ -763,7 +774,8 @@ export function ProviderInstanceCard({