Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(sqleditor): handle prop change correctly (#1895)

Liu Jic3ad3d650d80
diff --git a/frontend/src/components/MonacoEditor/MonacoEditor.vue b/frontend/src/components/MonacoEditor/MonacoEditor.vue
index 92768a00bd..1ba2c4598b 100644
--- a/frontend/src/components/MonacoEditor/MonacoEditor.vue
+++ b/frontend/src/components/MonacoEditor/MonacoEditor.vue
@@ -197,6 +197,15 @@ const setEditorContent = (content: string) => {
monacoInstanceRef.value?.setContent(editorInstanceRef.value!, content);
};
+watch(
+ () => props.value,
+ (value) => {
+ if (value !== getEditorContent()) {
+ setEditorContent(value);
+ }
+ }
+);
+
const getEditorContentHeight = () => {
return editorInstanceRef.value?.getContentHeight();
};