From cfc916bfdbc3885e3a083318b6274a1fb4216791 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:13:21 +0800 Subject: [PATCH] fix(vcs): Skip the Git Log diff preview when it cannot open --- src/features/vcs/GitLog.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/features/vcs/GitLog.tsx b/src/features/vcs/GitLog.tsx index 16e886ecc..d624c3bd1 100644 --- a/src/features/vcs/GitLog.tsx +++ b/src/features/vcs/GitLog.tsx @@ -1123,7 +1123,9 @@ export function CommitDetails({ commits }: { commits: Commit[] }) { clearTimeout(previewTimer.current); if (!logOptions().diffPreview || sel.size !== 1) return; const file = fileNodeAt(tree, [...sel][0]!)?.file; - if (file) previewTimer.current = setTimeout(() => void showChangesDiff([file], true), PREVIEW_DELAY); + // A preview that cannot open (no editor yet, the file went away) is just skipped. + if (file) + previewTimer.current = setTimeout(() => void showChangesDiff([file], true).catch(() => undefined), PREVIEW_DELAY); }; useEffect(() => {