From 75d0c29586a617f2cbfbf66720bdd0e47d6f92b4 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 21 Aug 2026 02:15:40 +0200 Subject: [PATCH] fix: apply the first script kind selection in the script editor (#10789) * fix: apply the first script kind selection in the script editor Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01QqKXVsBXynMFtMZ26uvLw7 * docs: record why the kind setter's early return is load-bearing Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01QqKXVsBXynMFtMZ26uvLw7 --------- Co-authored-by: Claude Opus 5 --- .../src/lib/components/ScriptBuilder.svelte | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte index 5c6cb3e5a8..4a1007d15a 100644 --- a/frontend/src/lib/components/ScriptBuilder.svelte +++ b/frontend/src/lib/components/ScriptBuilder.svelte @@ -1466,13 +1466,22 @@ corresponding action. {/snippet} + { - template = 'script' - script.kind = detail - initContent(script.language, detail, template) - }} + bind:selected={ + () => script.kind ?? 'script', + (kind) => { + // Load-bearing: any write to script.kind echoes back through the + // group, and initContent replaces the editor content outright. + if (kind === (script.kind ?? 'script')) return + template = 'script' + script.kind = kind as Script['kind'] + initContent(script.language, script.kind, template) + } + } > {#snippet children({ item })} {#each scriptKindOptions as { value, title, desc, documentationLink, Icon }}