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: resolve race condition in plan creation causing empty statement editor (#17277)
boojackb69d10cb0a33
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vueindex 064faf4d45..2c2beddc68 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue@@ -105,8 +105,7 @@ const createSheets = async () => {const configWithSheetList: Plan_ChangeDatabaseConfig[] = [];const pendingCreateSheetMap = new Map<string, Sheet>();- for (let i = 0; i < specs.length; i++) {- const spec = specs[i];+ for (const spec of specs) {const config =spec.config?.case === "changeDatabaseConfig" ? spec.config.value : null;if (!config) continue;@@ -114,29 +113,17 @@ const createSheets = async () => {if (pendingCreateSheetMap.has(config.sheet)) continue;const uid = extractSheetUID(config.sheet);if (uid.startsWith("-")) {- // The sheet is pending create- const sheet = getLocalSheetByName(config.sheet);+ // The sheet is pending create.+ const sheetToCreate = getLocalSheetByName(config.sheet);const engine = await databaseEngineForSpec(spec);- sheet.engine = engine;- pendingCreateSheetMap.set(sheet.name, sheet);+ sheetToCreate.engine = engine;+ sheetToCreate.title = plan.value.title;+ const createdSheet = await sheetStore.createSheet(+ project.value.name,+ sheetToCreate+ );+ config.sheet = createdSheet.name;}}- const pendingCreateSheetList = Array.from(pendingCreateSheetMap.values());- const sheetNameMap = new Map<string, string>();- for (let i = 0; i < pendingCreateSheetList.length; i++) {- const sheet = pendingCreateSheetList[i];- sheet.title = plan.value.title;- const createdSheet = await sheetStore.createSheet(- project.value.name,- sheet- );- sheetNameMap.set(sheet.name, createdSheet.name);- }- configWithSheetList.forEach((config) => {- const uid = extractSheetUID(config.sheet);- if (uid.startsWith("-")) {- config.sheet = sheetNameMap.get(config.sheet) ?? "";- }- });};</script>diff --git a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue b/frontend/src/components/Plan/components/StatementSection/StatementSection.vueindex 0eb13324cf..534c8e2fc7 100644--- a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue+++ b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue@@ -1,12 +1,13 @@<template><div v-show="viewMode !== 'NONE'" class="flex flex-col gap-y-2">- <EditorView v-if="viewMode === 'EDITOR'" :key="selectedSpec.id" />+ <EditorView v-if="viewMode === 'EDITOR'" :key="editorViewKey" /><ReleaseView v-else-if="viewMode === 'RELEASE'" /></div></template><script setup lang="ts">import { computed } from "vue";+import { sheetNameForSpec } from "../../logic";import { useSelectedSpec } from "../SpecDetailView/context";import EditorView from "./EditorView";import ReleaseView from "./ReleaseView";@@ -28,4 +29,8 @@ const viewMode = computed((): "NONE" | "EDITOR" | "RELEASE" => {}return "NONE";});++const editorViewKey = computed(() => {+ return `${selectedSpec.value.id}-${sheetNameForSpec(selectedSpec.value)}`;+});</script>