authorgravatar for 71498452+StiensWout@users.noreply.github.comWout Stiens <71498452+StiensWout@users.noreply.github.com> 2026-08-19 20:23:20+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-19 14:23:20-04:00
log4347f14b89ed66777ae16def278fd44575ab499b
tree31965ddd02c2d46734c33f6f1bf28db5bfc6abb8
parent68d569138b0a2ac250004df69e4d5a663f11574b
signature Signed by PGP key B5690EEEBB952194

fix(web): refresh open file with the file tree (#7490)


2 files changed, 8 insertions(+), 1 deletions(-)

apps/web/src/components/files/FileBrowserPanel.tsx+7-1
......@@ -31,6 +31,7 @@ interface FileBrowserPanelProps {
3131 /** Bumped when the same path should be revealed again (e.g. re-opened from search). */
3232 selectedPathRevealId: number;
3333 onOpenFile: (relativePath: string) => void;
34 onRefreshSelectedFile?: () => void;
3435}
3536
3637const TREE_UNSAFE_CSS = `
......@@ -105,6 +106,7 @@ export default function FileBrowserPanel({
105106 selectedPath,
106107 selectedPathRevealId,
107108 onOpenFile,
109 onRefreshSelectedFile,
108110}: FileBrowserPanelProps) {
109111 const { resolvedTheme } = useTheme();
110112 const composerRef = useComposerHandleContext();
......@@ -254,6 +256,10 @@ export default function FileBrowserPanel({
254256 }
255257 search.setValue(value);
256258 };
259 const handleRefresh = () => {
260 entriesQuery.refresh();
261 onRefreshSelectedFile?.();
262 };
257263
258264 useEffect(() => {
259265 if (previousTreePathsRef.current === treePaths) return;
......@@ -354,7 +360,7 @@ export default function FileBrowserPanel({
354360 className="flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent"
355361 data-surface-subheader
356362 >
357 <RefreshFilesButton isPending={entriesQuery.isPending} onRefresh={entriesQuery.refresh} />
363 <RefreshFilesButton isPending={entriesQuery.isPending} onRefresh={handleRefresh} />
358364 <FileSearchField
359365 name="project-files-search"
360366 ariaLabel={`Search ${projectName} files`}
apps/web/src/components/files/FilePreviewPanel.tsx+1
......@@ -1080,6 +1080,7 @@ export default function FilePreviewPanel({
10801080 selectedPath={relativePath}
10811081 selectedPathRevealId={revealRequestId}
10821082 onOpenFile={onOpenFile}
1083 {...(relativePath && !isImage ? { onRefreshSelectedFile: file.refresh } : {})}
10831084 />
10841085 </aside>
10851086 ) : null}