From 10388e43f1177760b5dc24e984b715af11624186 Mon Sep 17 00:00:00 2001 From: Abhigyan Patwari Date: Sat, 4 Apr 2026 08:11:40 +0530 Subject: [PATCH] fix(web): preserve ?server= in URL so F5 reconnects to correct server+repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, auto-connect immediately stripped ?server= from the URL. This made the ?project= param useless — F5 would show onboarding instead of reconnecting. Now ?server= stays in the URL, and the DropZone connect flow also sets ?server= so both paths support F5 recovery. The autoConnectRan ref prevents re-trigger within the same session. Co-Authored-By: Claude Opus 4.6 (1M context) --- gitnexus-web/src/App.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gitnexus-web/src/App.tsx b/gitnexus-web/src/App.tsx index e15711c7b..7ce4c97df 100644 --- a/gitnexus-web/src/App.tsx +++ b/gitnexus-web/src/App.tsx @@ -111,9 +111,9 @@ const AppContent = () => { const serverUrl = params.get('server') || window.location.origin; const projectParam = params.get('project') || undefined; - // Clean the URL so a refresh won't re-trigger auto-connect - const cleanUrl = window.location.pathname + window.location.hash; - window.history.replaceState(null, '', cleanUrl); + // Keep ?server= in the URL so F5 reconnects to the same server. + // autoConnectRan.current prevents re-trigger within the same session. + // handleServerConnect() will add/update ?project= after connecting. setProgress({ phase: 'extracting', @@ -219,7 +219,12 @@ const AppContent = () => { await handleServerConnect(result); setProgress(null); if (serverUrl) { - setServerBaseUrl(normalizeServerUrl(serverUrl)); + const base = normalizeServerUrl(serverUrl); + setServerBaseUrl(base); + // Add ?server= so F5 reconnects to this server + const url = new URL(window.location.href); + url.searchParams.set('server', base); + window.history.replaceState(null, '', url.toString()); } }} />