From 3e01de100ee3f3bd63f418b039ad7e1a7206ea51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Fri, 7 Aug 2026 00:27:41 +0000 Subject: [PATCH] retire a leftover ?cwd= from chat urls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nothing reads it and nothing writes it any more, but a refresh re-requests the address bar verbatim, so one left over from before the path-based groups sits there indefinitely looking like it means something. on a bare /chat it still says which group you wanted, so upgrade it to /chat/g/ rather than dropping it — an old bookmark keeps working. anywhere else the session decides its own directory, so it is just removed. other params untouched. Co-Authored-By: Claude Opus 5 --- .../Screens/Dashboard/ChatHistory/index.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx b/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx index 44a726fd..4d583284 100644 --- a/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx +++ b/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx @@ -64,6 +64,22 @@ export const SessionListPage = ({ isNew }: SessionListPageProps) => { } }, [rawWorkspace.isLoaded, workspace.value, rawWorkspace.value]); + // Retire a legacy `?cwd=`. Nothing reads it any more and nothing writes it, but a refresh re-requests + // the address bar verbatim — so one left over from before the path-based groups sits there forever, + // looking like it means something. On a bare /chat it still says which group you wanted, so upgrade + // it to the path form rather than dropping it; anywhere else the session decides its own directory + // and the parameter is simply removed. Other params are left alone. + useEffect(() => { + const params = new URLSearchParams(window.location.search); + const legacyCwd = params.get('cwd'); + if (legacyCwd === null) return; + params.delete('cwd'); + const rest = params.toString(); + const canBeUpgraded = !sessionId && !isNew && !groupCwd && legacyCwd.startsWith('/'); + const path = canBeUpgraded ? chatListPath(legacyCwd) : window.location.pathname; + navigate(`${path}${rest ? `?${rest}` : ''}`, { replace: true }); + }, [sessionId, isNew, groupCwd, navigate]); + // Fresh /chat/ (deep-link or refresh): all we have is the id. Resolve the session by id — the // backend scans project groups — so the cwd picker lands on its real dir AND the chat resumes, exactly // as clicking it from the list would. Guarded so it never clobbers an already-loaded selection.