From 50b1a3471c676e2178466203ed6f1fc6c45b8a74 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 6 Oct 2024 15:30:16 -0700 Subject: [PATCH] refac --- src/lib/components/common/CodeEditor.svelte | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/components/common/CodeEditor.svelte b/src/lib/components/common/CodeEditor.svelte index 7a6a19536..e9769e0c6 100644 --- a/src/lib/components/common/CodeEditor.svelte +++ b/src/lib/components/common/CodeEditor.svelte @@ -31,11 +31,13 @@ } const updateValue = () => { - _value = value; - if (codeEditor) { - codeEditor.dispatch({ - changes: [{ from: 0, to: codeEditor.state.doc.length, insert: _value }] - }); + if (_value !== value) { + _value = value; + if (codeEditor) { + codeEditor.dispatch({ + changes: [{ from: 0, to: codeEditor.state.doc.length, insert: _value }] + }); + } } };