Skip to content

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

chore: update editing state regeneration (#7218)

boojackd262cea5ce18
diff --git a/frontend/src/components/SchemaDesigner/index.vue b/frontend/src/components/SchemaDesigner/index.vue
index 632bde9935..1f498286de 100644
--- a/frontend/src/components/SchemaDesigner/index.vue
+++ b/frontend/src/components/SchemaDesigner/index.vue
@@ -3,7 +3,7 @@
<Splitpanes
class="default-theme w-full h-full flex flex-row overflow-hidden"
>
- <Pane size="25">
+ <Pane min-size="15" size="25">
<AsidePanel />
</Pane>
<Pane min-size="60" size="75">
@@ -24,7 +24,7 @@ import { SchemaDesignerTabState } from "./common/type";
import AsidePanel from "./AsidePanel.vue";
import Designer from "./Designer.vue";
import { Schema, convertSchemaMetadataList } from "@/types";
-import { cloneDeep } from "lodash-es";
+import { cloneDeep, isEqual } from "lodash-es";
const props = defineProps<{
readonly: boolean;
@@ -63,17 +63,28 @@ watch(
metadata.value =
cloneDeep(props.schemaDesign?.schemaMetadata) ||
DatabaseMetadata.fromPartial({});
- editableSchemas.value = convertSchemaMetadataList(metadata.value.schemas);
- originalSchemas.value = cloneDeep(editableSchemas.value);
readonly.value = props.readonly;
engine.value = props.engine;
- // NOTE: clear tab state in the following cases:
+ },
+ {
+ immediate: true,
+ deep: true,
+ }
+);
+
+watch(
+ () => metadata.value,
+ (value, oldValue) => {
+ // NOTE: regenerate editing state in the following cases:
// * change baseline schema.
// * change selected schema design.
- // * toggle the editing state.
- tabState.value = {
- tabMap: new Map(),
- };
+ if (!isEqual(value, oldValue)) {
+ editableSchemas.value = convertSchemaMetadataList(metadata.value.schemas);
+ originalSchemas.value = cloneDeep(editableSchemas.value);
+ tabState.value = {
+ tabMap: new Map(),
+ };
+ }
},
{
immediate: true,
diff --git a/frontend/src/components/SchemaEditor/SchemaEditor.vue b/frontend/src/components/SchemaEditor/SchemaEditor.vue
index b23a778eea..529b286964 100644
--- a/frontend/src/components/SchemaEditor/SchemaEditor.vue
+++ b/frontend/src/components/SchemaEditor/SchemaEditor.vue
@@ -3,7 +3,7 @@
<Splitpanes
class="default-theme w-full h-full flex flex-row overflow-hidden"
>
- <Pane size="20">
+ <Pane min-size="15" size="20">
<AsidePanel />
</Pane>
<Pane min-size="60" size="80">