mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 16:24:33 +00:00
fix(oracle): refresh schema cache and complete table lists
This commit is contained in:
@@ -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