From 41eef08bc409ba2a5a49e7d785bd113da51bab23 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Fri, 24 Apr 2026 17:57:26 -0700 Subject: Push value prop changes into Editor's CodeMirror state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Editor read the value prop once at mount and never reconciled later mutations into the CodeMirror doc. Result viewer never showed query output, format button output never reached the editor, and history loads stayed invisible. Add an effect that diffs the doc against the incoming value and dispatches a replacement transaction when they differ — guard against the user-typing echo by skipping when they already match. --- source/library/components/Editor.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/library/components/Editor.svelte') diff --git a/source/library/components/Editor.svelte b/source/library/components/Editor.svelte index 393812a..073a76a 100644 --- a/source/library/components/Editor.svelte +++ b/source/library/components/Editor.svelte @@ -115,6 +115,18 @@ // Invalid SDL — silently skip; editor keeps working without schema awareness } }); + + $effect(() => { + if (!view) + return; + + if (view.state.doc.toString() === value) + return; + + view.dispatch({ + changes: { from: 0, insert: value, to: view.state.doc.length } + }); + });