diff --git a/src/ui/src/components/core/input/CoreSliderInput.vue b/src/ui/src/components/core/input/CoreSliderInput.vue index b2d8b1971..4d2bf49e1 100644 --- a/src/ui/src/components/core/input/CoreSliderInput.vue +++ b/src/ui/src/components/core/input/CoreSliderInput.vue @@ -103,6 +103,7 @@ const { formValue, handleInput } = useFormValueBroker( wf, instancePath, rootInstance, + 50, ); diff --git a/src/ui/src/components/core/input/CoreSliderRangeInput.vue b/src/ui/src/components/core/input/CoreSliderRangeInput.vue index 3ebd4db60..332fe0588 100644 --- a/src/ui/src/components/core/input/CoreSliderRangeInput.vue +++ b/src/ui/src/components/core/input/CoreSliderRangeInput.vue @@ -6,7 +6,7 @@ > ( wf, instancePath, rootInstance, + [20, 50], ); diff --git a/src/ui/src/renderer/useFormValueBroker.ts b/src/ui/src/renderer/useFormValueBroker.ts index 90d8ce803..cc854b686 100644 --- a/src/ui/src/renderer/useFormValueBroker.ts +++ b/src/ui/src/renderer/useFormValueBroker.ts @@ -3,17 +3,19 @@ import { useEvaluator } from "@/renderer/useEvaluator"; import { Core, InstancePath } from "@/writerTypes"; /** - * * Encapsulates repeatable form value logic, including binding. * * @param wf * @param componentId + * @param defaultValue the initial value when binding is not set * @returns */ export function useFormValueBroker( wf: Core, instancePath: InstancePath, emitterEl: Ref, + // @ts-expect-error keep default string for compatibility reason + defaultValue: T = "", ) { const formValue: Ref = ref(); const isBusy = ref(false); @@ -110,7 +112,7 @@ export function useFormValueBroker( formValue, (newValue) => { if (typeof newValue === "undefined") { - formValue.value = "" as T; + formValue.value = defaultValue; } }, { immediate: true },