GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): the Files tree remembers expanded folders by fixfon · Pull Request #18211 · pingdotgg/t3code

fix(web): the Files tree remembers expanded folders #18211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fixfon wants to merge 12 commits into pingdotgg:main from fixfon:fix/files-tree-remember-expanded

Uh oh!

There was an error while loading. Please reload this page.

Closed

fix(web): the Files tree remembers expanded folders #18211

Changes from 1 commit
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
74f3bf5
fix(web): the Files tree remembers expanded folders
fixfon Oct 11, 2026
96dbc2a
Merge remote-tracking branch 'origin/main' into fix/files-tree-rememb…
juliusmarminge Oct 19, 2026
a13a017
test(web): cover remembered file tree expansion
juliusmarminge Oct 19, 2026
b9d1bc4
fix(web): keep collapsed folders closed during restoration
juliusmarminge Oct 19, 2026
9af9dcc
test(web): cover retained file selection across explorer remounts
juliusmarminge Oct 19, 2026
a9c8803
fix(web): preserve collapsed folders across explorer remounts
juliusmarminge Oct 19, 2026
8c81af2
test(web): cover file tree search loading and tab selection regressions
juliusmarminge Oct 19, 2026
ae67dac
fix(web): keep file reveals active after acknowledgement
juliusmarminge Oct 19, 2026
bb1ce66
test(web): cover retained file selection after remount
juliusmarminge Oct 19, 2026
6264eae
fix(web): restore retained file selection after remount
juliusmarminge Oct 19, 2026
64e28e2
test(web): reproduce deep file reveal loss after explorer remount
juliusmarminge Oct 19, 2026
2fcd03e
fix(web): defer file reveal acknowledgment until listings arrive
juliusmarminge Oct 19, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(web): keep file reveals active after acknowledgement
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge committed Oct 19, 2026
commit ae67dac0a0fdcac3fcd06adaf1bda116da1997a7

There are no files selected for viewing

57 changes: 43 additions & 14 deletions 57 apps/web/src/components/files/FileBrowserPanel.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,27 @@ export default function FileBrowserPanel({
const previousTreePathsRef = useRef<readonly string[] | null>(null);
const syncingSelectionRef = useRef(false);
const treeSelectionPathRef = useRef<string | null>(null);
const handledRevealRef = useRef<{ path: string; revealId: number } | null>(null);
const handledRevealRef = useRef<{
path: string;
revealId: number;
selectionMissing?: boolean;
} | null>(null);
// Preserve a collapse across remounts, but still reveal later active-file changes.
const initialHandledRevealRef = useRef(
selectedPathRevealHandled ? { path: selectedPath, revealId: selectedPathRevealId } : null,
);
const shouldSkipInitialReveal = useStableCallback((path: string | null, revealId: number) => {
const initialReveal = initialHandledRevealRef.current;
if (
selectedPathRevealHandled &&
initialReveal?.path === path &&
initialReveal?.revealId === revealId
) {
return true;
}
initialHandledRevealRef.current = null;
return false;
});

// The tree renders rows in shadow DOM and its anchor rect is unreliable, so
// capture the right-click position ourselves; contextmenu is a composed
Expand Down Expand Up @@ -426,13 +446,13 @@ export default function FileBrowserPanel({
);
}, [entries, model]);
useEffect(() => {
if (!selectedPath || selectedPathRevealHandled) return;
if (shouldSkipInitialReveal(selectedPath, selectedPathRevealId) || !selectedPath) return;
const controller = new AbortController();
void loadFileAncestors(selectedPath, load, { signal: controller.signal });
return () => {
controller.abort();
};
}, [load, selectedPath, selectedPathRevealHandled]);
}, [load, selectedPath, selectedPathRevealId, shouldSkipInitialReveal]);
const handleSearchValueChange = (value: string) => {
setQuery(value);
if (value.trim().length === 0) {
Expand Down Expand Up @@ -474,28 +494,37 @@ export default function FileBrowserPanel({
}, [directoryPaths, expandAll, model, query]);

useEffect(() => {
if (!selectedPath || selectedPathRevealHandled) {
if (shouldSkipInitialReveal(selectedPath, selectedPathRevealId) || !selectedPath) {
handledRevealRef.current = null;
return;
}
const revealRequest = { path: selectedPath, revealId: selectedPathRevealId };
const handledReveal = handledRevealRef.current;
const sameReveal =
handledReveal?.path === revealRequest.path &&
handledReveal.revealId === revealRequest.revealId;
const selectedKind = entryKinds.get(selectedPath);
if (selectedKind === undefined) {
handledRevealRef.current = null;
// Closing search can remove a provisional result before its listing arrives.
if (sameReveal) handledReveal.selectionMissing = true;
else handledRevealRef.current = null;
return;
}
const revealRequest = { path: selectedPath, revealId: selectedPathRevealId };
const handledReveal = handledRevealRef.current;
// Entry refreshes rebuild treePaths while the same preview stays open.
// Replaying a handled reveal would close an active tree search and steal focus.
if (
handledReveal?.path === revealRequest.path &&
handledReveal.revealId === revealRequest.revealId
) {
return;
}
if (sameReveal && !handledReveal.selectionMissing) return;
const selectedTreePath = selectedKind === "directory" ? `${selectedPath}/` : selectedPath;
const selectedItem = model.getItem(selectedTreePath);
if (!selectedItem) return;
if (sameReveal && model.isSearchOpen()) {
handledRevealRef.current = revealRequest;
syncingSelectionRef.current = true;
selectedItem.select();
queueMicrotask(() => {
syncingSelectionRef.current = false;
});
return;
}

// A selection that originated inside the tree (clicking a row, possibly
// in an active tree search) is already visible; re-revealing it would
Expand Down Expand Up @@ -545,7 +574,7 @@ export default function FileBrowserPanel({
model,
selectedPath,
selectedPathRevealId,
selectedPathRevealHandled,
shouldSkipInitialReveal,
onSelectedPathRevealHandled,
]);

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.