Skip to content

Commit e8b3c9c

Browse files
committed
Fix the updating of the schema browser
1 parent a1588af commit e8b3c9c

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

daiquiri/metadata/assets/js/components/Schemas.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,17 @@ const Schemas = ({ schemas, activeItem, setActiveItem, getTooltip, onDoubleClick
4747
setVisibleColumns((isNil(table) || isNil(table.columns)) ? [] : table.columns)
4848

4949
} else if (activeItem.type == 'table') {
50-
// search for the schema and table
51-
const [schema, table] = schemas.reduce((result, schema) => {
50+
// search for the table
51+
const table = schemas.reduce((result, schema) => {
5252
const table = (schema.tables || []).find(t => isEqual(t, activeItem))
53-
return isNil(table) ? result : [schema, table]
54-
}, [])
55-
56-
if (schema) {
57-
setOpenSchema(schema)
58-
setVisibleTables(schema.tables)
59-
}
53+
return isNil(table) ? result : table
54+
}, null )
6055

6156
if (table) {
6257
setOpenTable(table)
6358
setVisibleColumns(table.columns)
6459
}
6560

66-
} else if (activeItem.type == 'column') {
67-
// search for the schema and the table for the column
68-
const [schema, table] = schemas.reduce((result, schema) => {
69-
const table = (schema.tables || []).find(t => (t.columns && t.columns.find(c => isEqual(c, activeItem))))
70-
return isNil(table) ? result : [schema, table]
71-
}, [])
72-
73-
if (schema) {
74-
setOpenSchema(schema)
75-
setVisibleTables(schema.tables)
76-
}
77-
78-
if (table) {
79-
setOpenTable(table)
80-
setVisibleColumns(table.columns)
81-
}
8261
}
8362
}
8463
}

0 commit comments

Comments
 (0)