Skip to content

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

fix: prevent role selector from reverting SQL edits during edit mode (#17870)

Vincent Huangd12337209a06
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
index 610bcd5f21..35e29d47a1 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
@@ -508,7 +508,19 @@ const handleStatementChange = (value: string) => {
watch(
sheetStatement,
- (statement) => {
+ (statement, oldStatement) => {
+ // Don't overwrite user's edits if they're currently in edit mode
+ if (state.isEditing) {
+ return;
+ }
+
+ // Don't overwrite if the user has made local changes since the last
+ // sheet update (i.e., current state doesn't match the old sheet statement)
+ if (oldStatement !== undefined && state.statement !== oldStatement) {
+ return;
+ }
+
+ // Safe to update: not editing and no divergence from previous sheet state
state.statement = statement;
},
{ immediate: true }
diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
index 5459537fae..0b3f108e10 100644
--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
@@ -474,7 +474,19 @@ const handleStatementChange = (statement: string) => {
watch(
sheetStatement,
- (statement) => {
+ (statement, oldStatement) => {
+ // Don't overwrite user's edits if they're currently in edit mode
+ if (editorState.isEditing.value) {
+ return;
+ }
+
+ // Don't overwrite if the user has made local changes since the last
+ // sheet update (i.e., current state doesn't match the old sheet statement)
+ if (oldStatement !== undefined && state.statement !== oldStatement) {
+ return;
+ }
+
+ // Safe to update: not editing and no divergence from previous sheet state
state.statement = statement;
},
{ immediate: true }