From f7cc87e8ce7a91527fd098b4f322496dbc0c708c Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 25 Jan 2026 17:44:47 -0600 Subject: [PATCH] fix validation for schema objects that can be null --- .../config-form/theme/widgets/TextWidget.tsx | 12 +++- .../theme/widgets/TextareaWidget.tsx | 12 +++- web/src/lib/config-schema/transformer.ts | 61 ++++++++++++++++--- web/src/views/settings/GlobalConfigView.tsx | 6 +- 4 files changed, 78 insertions(+), 13 deletions(-) diff --git a/web/src/components/config-form/theme/widgets/TextWidget.tsx b/web/src/components/config-form/theme/widgets/TextWidget.tsx index 58eb9b79d..84e809c4d 100644 --- a/web/src/components/config-form/theme/widgets/TextWidget.tsx +++ b/web/src/components/config-form/theme/widgets/TextWidget.tsx @@ -16,6 +16,10 @@ export function TextWidget(props: WidgetProps) { options, } = props; + const isNullable = Array.isArray(schema.type) + ? schema.type.includes("null") + : false; + return ( - onChange(e.target.value === "" ? undefined : e.target.value) + onChange( + e.target.value === "" + ? isNullable + ? null + : undefined + : e.target.value, + ) } onBlur={(e) => onBlur(id, e.target.value)} onFocus={(e) => onFocus(id, e.target.value)} diff --git a/web/src/components/config-form/theme/widgets/TextareaWidget.tsx b/web/src/components/config-form/theme/widgets/TextareaWidget.tsx index 0a2e03305..5eccfb965 100644 --- a/web/src/components/config-form/theme/widgets/TextareaWidget.tsx +++ b/web/src/components/config-form/theme/widgets/TextareaWidget.tsx @@ -16,6 +16,10 @@ export function TextareaWidget(props: WidgetProps) { options, } = props; + const isNullable = Array.isArray(schema.type) + ? schema.type.includes("null") + : false; + return (