Skip to content

Commit 673bd5b

Browse files
committed
Fix environment rows and drawer height ignoring prop updates
- ProviderEnvironmentSection: Add a key derived from the environment data so React remounts the component when props change, keeping draft rows in sync with external updates (e.g. server reconciliation). - ThreadTerminalDrawer: Sync drawerHeightState from the controlled height prop so that persisted or parent-driven height updates apply without requiring a threadId change or manual resize.
1 parent 344fca1 commit 673bd5b

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

apps/web/src/components/ThreadTerminalDrawer.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,11 @@ export default function ThreadTerminalDrawer({
11061106

11071107
useEffect(() => {
11081108
lastSyncedHeightRef.current = controlledDrawerHeight;
1109+
setDrawerHeightState((current) =>
1110+
current.threadId === threadId && current.height === controlledDrawerHeight
1111+
? current
1112+
: { threadId, height: controlledDrawerHeight },
1113+
);
11091114
}, [controlledDrawerHeight, threadId]);
11101115

11111116
const handleResizePointerDown = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {

apps/web/src/components/settings/ProviderInstanceCard.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ function makeEnvironmentDraftRow(
7777
};
7878
}
7979

80+
function getProviderEnvironmentSectionKey(
81+
environment: ReadonlyArray<ProviderInstanceEnvironmentVariable>,
82+
): string {
83+
return JSON.stringify(
84+
environment.map((variable) => [
85+
variable.name,
86+
variable.value,
87+
variable.sensitive,
88+
variable.valueRedacted ?? null,
89+
]),
90+
);
91+
}
92+
8093
/**
8194
* Read a string[] at `key` from the opaque config blob, filtering out
8295
* non-string entries. Used for `customModels`, which is always typed as
@@ -444,6 +457,8 @@ export function ProviderInstanceCard({
444457
: null;
445458

446459
const customModels = readConfigStringArray(instance.config, "customModels");
460+
const environment = instance.environment ?? [];
461+
const environmentSectionKey = getProviderEnvironmentSectionKey(environment);
447462
// Server-returned models may lag behind settings writes. Treat probe
448463
// models as the source for built-ins only; custom rows come directly
449464
// from the current instance config so add/remove reflects immediately.
@@ -759,7 +774,8 @@ export function ProviderInstanceCard({
759774

760775
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
761776
<ProviderEnvironmentSection
762-
environment={instance.environment ?? []}
777+
key={environmentSectionKey}
778+
environment={environment}
763779
onChange={updateEnvironment}
764780
/>
765781
</div>

0 commit comments

Comments
 (0)