diff --git a/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte b/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte index d500e9a33e..d47a6344d1 100644 --- a/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte +++ b/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte @@ -129,15 +129,16 @@ // When the runnable input schema cannot be rendered (unavailable, empty, or // without properties) but the schedule already has stored args, fall back to a // raw JSON editor so existing args remain visible instead of implying the - // runnable takes no argument. + // runnable takes no argument. The editor's code is initialized once and the + // fallback stays visible until a renderable schema appears, so emptying the + // JSON while editing does not make the editor disappear from under the user. let rawArgsEditorCode: string | undefined = $state(undefined) + let showRawArgsFallback = $derived(!hasRenderableSchema && rawArgsEditorCode !== undefined) $effect(() => { - if (!hasRenderableSchema && hasArgs) { - if (rawArgsEditorCode === undefined) { - rawArgsEditorCode = JSON.stringify($state.snapshot(args), null, 2) - } - } else { + if (hasRenderableSchema) { rawArgsEditorCode = undefined + } else if (hasArgs && rawArgsEditorCode === undefined) { + rawArgsEditorCode = JSON.stringify($state.snapshot(args), null, 2) } }) @@ -764,8 +765,8 @@