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): defer file reveal acknowledgment until listings arrive · pingdotgg/t3code@2fcd03e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/files
    • FileBrowserPanel.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/files/FileBrowserPanel.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/files/FileBrowserPanel.tsx
+20-5Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,24 @@ export default function FileBrowserPanel({
511511
else handledRevealRef.current = null;
512512
return;
513513
}
514-
// Entry refreshes rebuild treePaths while the same preview stays open.
515-
// Replaying a handled reveal would close an active tree search and steal focus.
516-
if (sameReveal && !handledReveal.selectionMissing) return;
517514
const selectedTreePath = selectedKind === "directory" ? `${selectedPath}/` : selectedPath;
518515
const selectedItem = model.getItem(selectedTreePath);
519516
if (!selectedItem) return;
517+
const acknowledgeReveal = () => {
518+
// Search-only rows can disappear before their directory listings arrive.
519+
if (
520+
!selectedPathRevealHandled &&
521+
directoryEntries.some((entry) => entry.path === selectedPath)
522+
) {
523+
onSelectedPathRevealHandled();
524+
}
525+
};
526+
// Entry refreshes rebuild treePaths while the same preview stays open.
527+
// Replaying a handled reveal would close an active tree search and steal focus.
528+
if (sameReveal && !handledReveal.selectionMissing) {
529+
acknowledgeReveal();
530+
return;
531+
}
520532
// A retained preview needs selection in the new model without replaying its reveal.
521533
if (skipInitialReveal || (sameReveal && model.isSearchOpen())) {
522534
handledRevealRef.current = revealRequest;
@@ -525,6 +537,7 @@ export default function FileBrowserPanel({
525537
model.getItem(path)?.deselect();
526538
}
527539
selectedItem.select();
540+
acknowledgeReveal();
528541
queueMicrotask(() => {
529542
syncingSelectionRef.current = false;
530543
});
@@ -541,12 +554,11 @@ export default function FileBrowserPanel({
541554
if (selectedInTree && treeSelectionPathRef.current === selectedPath) {
542555
treeSelectionPathRef.current = null;
543556
handledRevealRef.current = revealRequest;
544-
onSelectedPathRevealHandled();
557+
acknowledgeReveal();
545558
return;
546559
}
547560
treeSelectionPathRef.current = null;
548561
handledRevealRef.current = revealRequest;
549-
onSelectedPathRevealHandled();
550562

551563
syncingSelectionRef.current = true;
552564
setQuery("");
@@ -571,14 +583,17 @@ export default function FileBrowserPanel({
571583
focus: true,
572584
offset: "center",
573585
});
586+
acknowledgeReveal();
574587
queueMicrotask(() => {
575588
syncingSelectionRef.current = false;
576589
});
577590
}, [
591+
directoryEntries,
578592
entryKinds,
579593
model,
580594
selectedPath,
581595
selectedPathRevealId,
596+
selectedPathRevealHandled,
582597
shouldSkipInitialReveal,
583598
onSelectedPathRevealHandled,
584599
]);

0 commit comments

Comments
0 (0)
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.