From fa984df5edd0472af35105e99fd8a4b191d37c6d Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Tue, 9 Jun 2026 08:14:13 +0200 Subject: [PATCH] fix: keep raw JSON args fallback open while editing schedule Co-Authored-By: Claude Opus 4.8 (1M context) --- .../schedules/ScheduleEditorInner.svelte | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 @@
{#snippet rawArgsFallback()} - The {is_flow ? 'flow' : 'script'} input schema could not be rendered. The stored - arguments are shown below as raw JSON. + The {is_flow ? 'flow' : 'script'} input schema could not be rendered. The stored arguments + are shown below as raw JSON. {#await import('$lib/components/JsonEditor.svelte')} @@ -984,7 +985,7 @@ bind:args /> {/await} - {:else if hasArgs} + {:else if showRawArgsFallback} {@render rawArgsFallback()} {:else}
@@ -996,7 +997,7 @@ You cannot see the the {is_flow ? 'flow' : 'script'} input form as you do not have access to it.
- {#if hasArgs} + {#if showRawArgsFallback} {@render rawArgsFallback()} {/if} {:else}