Skip to content

Commit 9443812

Browse files
committed
fix: respect clearWhenEmpty semantics for boolean fields
When clearWhenEmpty is 'omit' and a boolean field is set to false (the default value), remove the key from the config blob instead of storing it. This mirrors the string field behavior where clearing to empty removes the key, and prevents the config from growing monotonically once a switch is toggled.
1 parent f6731f0 commit 9443812

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ export function nextProviderConfigWithFieldValue(
109109
config !== null && typeof config === "object" ? { ...(config as Record<string, unknown>) } : {};
110110

111111
if (typeof value === "boolean") {
112-
base[field.key] = value;
112+
if (field.clearWhenEmpty === "omit" && value === false) {
113+
delete base[field.key];
114+
} else {
115+
base[field.key] = value;
116+
}
113117
return Object.keys(base).length > 0 ? base : undefined;
114118
}
115119

0 commit comments

Comments
 (0)