Compare commits

...
Author SHA1 Message Date
Cursor AgentandJulius Marminge f65e38f3d1 Remove provider environment sync effect
Co-authored-by: Julius Marminge <[email protected]>
2026-06-12 16:47:30 +00:00
@@ -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<ProviderInstanceEnvironmentVariable>,
): 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<EnvironmentDraftRow>) => {
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({
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
<ProviderEnvironmentSection
environment={instance.environment ?? []}
key={environmentSectionKey}
environment={environment}
onChange={updateEnvironment}
/>
</div>