fix(sidebar): cancel metadata loads when collapsing nodes

This commit is contained in:
dienaso authored and GitHub committed 2026-07-30 20:56:48 +08:00
1 parent 7f40aaccaf
commit 07ff185573
3 files changed
+88 -1

No files matched your search

@@ -6591,6 +6591,15 @@ export const useConnectionStore = defineStore("connection", () => {
clearConnectionError(normalized.id);
}
function cancelTreeNodeLoad(nodeId: string): void {
// Supersede any in-flight loader for this node so a collapse issued while
// the load is still running (or a loader that never resolves) cannot
// re-expand the node via its trailing `targetNode.isExpanded = true`.
treeNodeLoads.invalidatePrefix(nodeId);
const node = findNode(treeNodes.value, nodeId);
if (node) node.isLoading = false;
}
return {
connections,
activeConnectionId,
@@ -6663,6 +6672,7 @@ export const useConnectionStore = defineStore("connection", () => {
isTreeNodeChildrenLoaded,
canUseLoadedTreeNodeToggle,
releaseCollapsedTreeNodeChildren,
cancelTreeNodeLoad,
setBeforeConnectHandler,
initFromDisk,
loadDatabases,