Skip to content

Commit 5ea691d

Browse files
Julius Marmingeclaude
andcommitted
fix(web): reveal a diff tree file again after it leaves and returns
The handled-reveal guard stayed set while the selected file was absent from the tree, so a file dropped by a refresh and restored by the next one was never reselected under the same reveal request. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent de21796 commit 5ea691d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/web/src/components/diffs/DiffFileTree.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@ export function DiffFileTree({
109109
}
110110
// A path list that changes under an already-revealed file (a refresh, a later slice) must
111111
// not pull the tree back to it over whatever the reader has picked since.
112+
const item = model.getItem(selectedPath);
113+
if (item === null || item.isDirectory()) {
114+
// A file that left the diff has to be revealed again when it comes back.
115+
handledRevealRef.current = null;
116+
return;
117+
}
112118
const handled = handledRevealRef.current;
113119
if (handled?.path === selectedPath && handled.revealRequestId === revealRequestId) return;
114-
const item = model.getItem(selectedPath);
115-
if (item === null || item.isDirectory()) return;
116120
handledRevealRef.current = { path: selectedPath, revealRequestId };
117121
syncingSelectionRef.current = true;
118122
for (const path of model.getSelectedPaths()) {

0 commit comments

Comments
 (0)