fix(oracle): refresh schema cache and complete table lists
This commit is contained in:
1 parent
3e321d869c
commit
61bd7480f4
3 files changed
+60
-25
No files matched your search
@@ -322,9 +322,29 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
loadedTreeNodeChildrenIds.value.delete(id);
|
||||
}
|
||||
}
|
||||
api.deleteSchemaCachePrefix(`${prefix}:`).catch(() => undefined);
|
||||
api.deleteSchemaCachePrefix(`${schemaCacheKey(prefix)}:`).catch(() => undefined);
|
||||
}
|
||||
|
||||
function schemaCachePrefixForNode(node: TreeNode): string | null {
|
||||
if (node.type === "connection" && node.connectionId) {
|
||||
return `${schemaCacheKey(node.connectionId)}:`;
|
||||
}
|
||||
if (node.type === "database" && node.connectionId && node.database) {
|
||||
return `${schemaCacheKey(node.connectionId, node.database)}:`;
|
||||
}
|
||||
if (node.type === "schema" && node.connectionId && node.database && node.schema) {
|
||||
return `${schemaCacheKey(node.connectionId, node.database, node.schema)}:`;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function clearPersistedTreeCacheForNode(node: TreeNode) {
|
||||
const prefix = schemaCachePrefixForNode(node);
|
||||
if (!prefix) return;
|
||||
await api.deleteSchemaCachePrefix(prefix).catch(() => undefined);
|
||||
}
|
||||
|
||||
function findParentNode(nodes: TreeNode[], id: string, parent: TreeNode | null = null): TreeNode | null {
|
||||
for (const node of nodes) {
|
||||
if (node.id === id) return parent;
|
||||
@@ -948,6 +968,8 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
async function refreshTreeNode(node: TreeNode) {
|
||||
const expandedIds = collectExpandedNodeIds([node]);
|
||||
expandedIds.add(node.id);
|
||||
await clearPersistedTreeCacheForNode(node);
|
||||
clearLoadedChildrenCache(node.id);
|
||||
if (node.type !== "connection-group") {
|
||||
node.children = [];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user