Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): updating task sheet statement shouldn't update sheet id just creating new sheets (#5846)
p0ny55af32562886
diff --git a/frontend/src/components/Issue/IssueTaskStatementPanel.vue b/frontend/src/components/Issue/IssueTaskStatementPanel.vueindex 81de60f32c..80e599c368 100644--- a/frontend/src/components/Issue/IssueTaskStatementPanel.vue+++ b/frontend/src/components/Issue/IssueTaskStatementPanel.vue@@ -120,7 +120,6 @@</template><script lang="ts" setup>-import { v4 as uuidv4 } from "uuid";import { isNumber } from "lodash-es";import { useDialog } from "naive-ui";import { onMounted, reactive, watch, computed, ref, nextTick } from "vue";@@ -413,20 +412,9 @@ const saveEdit = async () => {if (!selectedDatabase.value) {return;}-if (allowFormatOnSave.value && formatOnSave.value) {editorRef.value?.formatEditorContent();}- // Create a new sheet instead of reusing the old one.- const sheet = await sheetStore.createSheet({- projectId: selectedDatabase.value.projectId,- name: uuidv4(),- statement: state.editStatement,- visibility: "PROJECT",- source: "BYTEBASE_ARTIFACT",- payload: {},- });- updateSheetId(sheet.id);await updateStatement(state.editStatement);state.editing = false;};diff --git a/frontend/src/components/Issue/logic/common.ts b/frontend/src/components/Issue/logic/common.tsindex 178794ea4e..93f78c5926 100644--- a/frontend/src/components/Issue/logic/common.ts+++ b/frontend/src/components/Issue/logic/common.ts@@ -1,6 +1,7 @@import { computed } from "vue";import { cloneDeep } from "lodash-es";import { useRoute } from "vue-router";+import { v4 as uuidv4 } from "uuid";import formatSQL from "@/components/MonacoEditor/sqlFormatter";import {useCurrentUser,@@ -35,7 +36,6 @@ import {defer,isDev,isTaskTriggeredByVCS,- sheetIdOfTask,taskCheckRunSummary,} from "@/utils";import { maybeApplyRollbackParams } from "@/plugins/issue/logic/initialize/standard";@@ -176,20 +176,26 @@ export const useCommonLogic = () => {} else {// Ask whether to apply the change to all pending tasks if possible.const task = selectedTask.value as Task;+ const issueEntity = issue.value as Issue;const patchingTaskList = await getPatchingTaskList(- issue.value as Issue,+ issueEntity,task,dialog);if (patchingTaskList.length === 0) return;++ // Create a new sheet instead of reusing the old one.+ const sheet = await sheetStore.createSheet({+ projectId: issueEntity.project.id,+ name: uuidv4(),+ statement: newStatement,+ visibility: "PROJECT",+ source: "BYTEBASE_ARTIFACT",+ payload: {},+ });+const patchRequestList = patchingTaskList.map((task) => {- const sheetId = sheetIdOfTask(task);- if (sheetId && sheetId !== UNKNOWN_ID) {- sheetStore.patchSheetById({- id: sheetId,- statement: newStatement,- });- }+ patchTask(task.id, { sheetId: sheet.id });});return Promise.allSettled(patchRequestList);}