Skip to content

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

fix: cannot expand pg schema (#8602)

ecmadao7e1c6cdb2798
diff --git a/frontend/src/components/SchemaEditorV1/Aside/BranchTree.vue b/frontend/src/components/SchemaEditorV1/Aside/BranchTree.vue
index 03b448cc45..b015b93d74 100644
--- a/frontend/src/components/SchemaEditorV1/Aside/BranchTree.vue
+++ b/frontend/src/components/SchemaEditorV1/Aside/BranchTree.vue
@@ -187,19 +187,20 @@ const treeData = computed(() => {
label: schema.name,
isLeaf: false,
schemaId: schema.id,
- };
- treeNodeList.push(schemaTreeNode);
- for (const table of schema.tableList) {
- const tableTreeNode: TreeNodeForTable = {
+ children: schema.tableList.map((table) => ({
type: "table",
key: `t-${schema.id}-${table.id}`,
label: table.name,
+ children: [],
isLeaf: true,
schemaId: schema.id,
tableId: table.id,
- };
- schemaTreeNode.children?.push(tableTreeNode);
+ })),
+ };
+ if (schemaTreeNode.children!.length === 0) {
+ schemaTreeNode.isLeaf = true;
}
+ treeNodeList.push(schemaTreeNode);
}
}
@@ -548,6 +549,13 @@ const openTabForTable = (treeNode: TreeNode) => {
schemaId: treeNode.schemaId,
tableId: treeNode.tableId,
});
+ } else if (treeNode.type === "schema") {
+ const index = expandedKeysRef.value.findIndex(
+ (key) => key === treeNode.key
+ );
+ if (index < 0) {
+ expandedKeysRef.value.push(treeNode.key);
+ }
}
state.shouldRelocateTreeNode = true;