diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index bfc3c81cc0..3abe981f72 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -98,6 +98,12 @@ customErrorMessage?: string | undefined onlyMaskPassword?: boolean nullable?: boolean + /** + * Write null into an untouched nullable string/list field. Only for forms whose value is + * submitted as run args: elsewhere an undefined value has its own meaning (an unset schema + * default, a step input still following its expression) that a written null would override. + */ + fillNullableDefault?: boolean title?: string | undefined placeholder?: string | undefined order?: string[] | undefined @@ -171,6 +177,7 @@ customErrorMessage = undefined, onlyMaskPassword = false, nullable = false, + fillNullableDefault = false, title = $bindable(undefined), placeholder = $bindable(undefined), order = $bindable(undefined), @@ -301,8 +308,19 @@ } } + // A nullable field's default is a real null: left undefined, the key is dropped + // from the submitted args and the runnable never receives it. + const unsetNullable = + fillNullableDefault && + nnullable && + value === undefined && + !ignoreValueUndefined && + (inputCat === 'string' || inputCat === 'list') if (nnullable && type === 'string' && value === '' && nvalue == null) { value = null + } else if (unsetNullable && nvalue == null) { + value = null + lastValue = value } else if (nvalue != null && !deepEqual(nvalue, value)) { value = nvalue lastValue = value @@ -867,6 +885,7 @@