Skip to content

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

chore: open and select new tab when schema/table is created (#9758)

Liu Ji7997cd3c1773
diff --git a/frontend/src/components/SchemaEditorLite/Modals/SchemaNameModal.vue b/frontend/src/components/SchemaEditorLite/Modals/SchemaNameModal.vue
index e96504d8b8..7acd25ef8e 100644
--- a/frontend/src/components/SchemaEditorLite/Modals/SchemaNameModal.vue
+++ b/frontend/src/components/SchemaEditorLite/Modals/SchemaNameModal.vue
@@ -82,13 +82,15 @@ const handleConfirmButtonClick = async () => {
},
"created"
);
- addTab({
- type: "database",
- database: props.database,
- metadata: {
- database: props.metadata,
- },
- selectedSchema: schema.name,
+ requestAnimationFrame(() => {
+ addTab({
+ type: "database",
+ database: props.database,
+ metadata: {
+ database: props.metadata,
+ },
+ selectedSchema: schema.name,
+ });
});
dismissModal();
diff --git a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
index c1656b2b3d..2d50dbd1ff 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
@@ -335,5 +335,11 @@ const handleApplyTemplate = (template: SchemaTemplateSetting_TableTemplate) => {
table.columns.forEach((column) => {
markEditStatus(db, { ...metadataForTable(), column }, "created");
});
+
+ addTab({
+ type: "table",
+ database: db,
+ metadata: metadataForTable(),
+ });
};
</script>
diff --git a/frontend/src/components/SchemaEditorLite/context/tabs.ts b/frontend/src/components/SchemaEditorLite/context/tabs.ts
index 7099976f65..1433ddbff6 100644
--- a/frontend/src/components/SchemaEditorLite/context/tabs.ts
+++ b/frontend/src/components/SchemaEditorLite/context/tabs.ts
@@ -31,7 +31,11 @@ export const useTabs = () => {
tabMap.value.set(id, tab);
if (setAsCurrentTab) {
- currentTabId.value = id;
+ // It's weird that nextTick doesn't work here
+ // So we need to delay a little bit longer
+ requestAnimationFrame(() => {
+ currentTabId.value = id;
+ });
}
};