diff --git a/src/App.svelte b/src/App.svelte index 52174ff..bcd419a 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1612,6 +1612,15 @@ fileHistoryCollapsed = false; } + function hideAndResetFileHistory() { + fileHistoryRequestId += 1; + cancelActiveFileHistoryLoad(); + activeFileHistoryRequestId = ""; + fileHistoryLoading = false; + fileHistory = []; + fileHistoryCollapsed = true; + } + function rememberRecentRepo(path: string) { recentRepoPaths = uniqueRepoPaths([path, ...recentRepoPaths]).slice(0, 40); persistRepoLists(); @@ -1818,7 +1827,7 @@ await refreshBranchList(path); await refreshTags(path); await refreshCommitHistory(path); - if (lastFileHistoryHeadHash !== previousHeadHash) { + if (lastFileHistoryHeadHash !== previousHeadHash && !fileHistoryCollapsed) { await refreshFileHistory(path); } } @@ -3262,7 +3271,7 @@ } async function selectExplorerNode(node: ExplorerNode) { - if (!activeRepoPath || (selectedExplorerPath === node.path && selectedExplorerKind === node.kind)) return; + if (!activeRepoPath) return; selectedExplorerPath = node.path; selectedExplorerKind = node.kind; revealFileHistory(); @@ -3292,9 +3301,7 @@ selectedExplorerPath = file.path; selectedExplorerKind = "file"; expandedExplorerPaths = new Set([...expandedExplorerPaths, ...explorerParentFolders(file.path)]); - revealFileHistory(); - - void loadSelectedFileHistory(file.path); + hideAndResetFileHistory(); trackEvent("explorer_file_selected", { source: "status", status: file.unstaged ?? file.staged ?? "unknown",