From 11c95126e374de1cd4768e16fa9877eb2b6c11ad Mon Sep 17 00:00:00 2001 From: weishu Date: Fri, 2 Jan 2026 16:02:35 +0800 Subject: [PATCH] fix: handle back navigation from single file view to files list --- web/src/hooks/useAppGoBack.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/hooks/useAppGoBack.ts b/web/src/hooks/useAppGoBack.ts index 598f6d7d..56a38dcf 100644 --- a/web/src/hooks/useAppGoBack.ts +++ b/web/src/hooks/useAppGoBack.ts @@ -13,6 +13,13 @@ export function useAppGoBack(): () => void { return } + // For single file view, go back to files list + if (pathname.match(/^\/sessions\/[^/]+\/file$/)) { + const filesPath = pathname.replace(/\/file$/, '/files') + navigate({ to: filesPath }) + return + } + // For session routes, navigate to parent path if (pathname.startsWith('/sessions/')) { const parentPath = pathname.replace(/\/[^/]+$/, '') || '/sessions'