From e5a9bdaa0c6495008961a72002f0c7c5deb58de8 Mon Sep 17 00:00:00 2001 From: Nathan Farmer Date: Tue, 5 Mar 2024 13:28:46 -0500 Subject: [PATCH] Update value default logic --- src/controls/NumericControl.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controls/NumericControl.tsx b/src/controls/NumericControl.tsx index 749c633..30fa095 100644 --- a/src/controls/NumericControl.tsx +++ b/src/controls/NumericControl.tsx @@ -17,7 +17,6 @@ export const createNumericControl = (args: { coerceNumber: (value: number) => nu uischema, }: ControlProps & RendererProps) { const arialLabelWithFallback = label || schema.description || "Value" - const value = data === null || (typeof data === "object" && Object.keys(data as object).length === 0) ? undefined : data as number const isRequired = required || uischema.options?.required as boolean const maxStepsWithoutTextInput = 100 @@ -33,6 +32,7 @@ export const createNumericControl = (args: { coerceNumber: (value: number) => nu const isLargeStepCount = stepCount && stepCount > maxStepsWithoutTextInput const initialValue: number | undefined = typeof schema?.default === "number" ? schema.default : minimum + const value = data === undefined ? initialValue : data as number | null const addonAfter = uischema.options?.addonAfter as string | undefined const addonBefore = uischema.options?.addonBefore as string | undefined @@ -87,7 +87,7 @@ export const createNumericControl = (args: { coerceNumber: (value: number) => nu } const slider =