mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-30 18:30:39 +08:00
🐛 fix(sidebar): 修复视图元数据重复导致侧边栏树渲染错乱
- MySQL 视图元数据缺失 schema 时回填当前数据库 - 避免多条回退查询生成重复视图节点 - 补充侧边栏视图去重回归测试
This commit is contained in:
@@ -24,6 +24,13 @@ describe('sidebarMetadata', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('falls back to the current database when MySQL-compatible view rows omit schema metadata', () => {
|
||||
expect(normalizeSidebarViewMetadataEntry('mysql', 'information_schema', '', 'CHARACTER_SETS')).toEqual({
|
||||
viewName: 'CHARACTER_SETS',
|
||||
schemaName: 'information_schema',
|
||||
});
|
||||
});
|
||||
|
||||
it('uses MySQL metadata queries for custom MySQL-compatible domestic drivers', () => {
|
||||
expect(resolveSidebarMetadataDialect('goldendb')).toBe('mysql');
|
||||
expect(resolveSidebarMetadataDialect('custom', 'gdb')).toBe('mysql');
|
||||
|
||||
@@ -78,9 +78,14 @@ export const normalizeSidebarViewMetadataEntry = (
|
||||
|
||||
const parsedViewName = splitQualifiedNameLast(viewName);
|
||||
const parsedNormalizedViewName = splitQualifiedNameLast(normalizedViewName);
|
||||
const normalizedDialect = String(dialect || '').trim().toLowerCase();
|
||||
const normalizedDbName = String(dbName || '').trim();
|
||||
const resolvedSchemaName = String(
|
||||
schemaName || parsedNormalizedViewName.parentPath || parsedViewName.parentPath || '',
|
||||
).trim();
|
||||
return {
|
||||
viewName: normalizedViewName,
|
||||
schemaName: String(schemaName || parsedNormalizedViewName.parentPath || parsedViewName.parentPath || '').trim(),
|
||||
schemaName: resolvedSchemaName || (normalizedDialect === 'mysql' ? normalizedDbName : ''),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user