From 00437e95002a63a8ba934d45ec5dfcffd080baf7 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Mon, 17 Aug 2026 18:36:55 +0200 Subject: [PATCH] fix: let the import wizard survive sign-in and a missing workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signing in with `rd=/projects/import?hub=...` dropped the destination: the login redirect only honours `rd` verbatim for `/user/workspaces`, so anyone with more than one workspace landed on the workspace picker instead — the page the wizard exists to replace, asking the question it was about to ask. Both copies of that logic now allow the wizard through. The root layout's "no workspace selected" redirect skips the wizard too. It picks the destination itself and may end in a workspace that does not exist yet, so bouncing it to the picker forces the very choice it is there to make. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/lib/components/Login.svelte | 8 +++++++- .../routes/(root)/(logged)/user/(user)/login/+page.svelte | 5 ++++- frontend/src/routes/(root)/+layout.svelte | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/Login.svelte b/frontend/src/lib/components/Login.svelte index 412884cb07..b4e8e8ee6a 100644 --- a/frontend/src/lib/components/Login.svelte +++ b/frontend/src/lib/components/Login.svelte @@ -196,7 +196,13 @@ } else { goto(resolvedRd ?? '/') } - } else if (resolvedRd?.startsWith('/user/workspaces')) { + // The import wizard picks the destination workspace itself, so sending it to + // the workspace picker first asks the same question twice — and the wizard + // may end in a workspace that does not exist yet. + } else if ( + resolvedRd?.startsWith('/user/workspaces') || + resolvedRd?.startsWith('/projects/import') + ) { goto(resolvedRd) } else if (resolvedRd == '/#user-settings') { goto(`/user/workspaces#user-settings`) diff --git a/frontend/src/routes/(root)/(logged)/user/(user)/login/+page.svelte b/frontend/src/routes/(root)/(logged)/user/(user)/login/+page.svelte index 2ea7ab1c89..dea6e2cc64 100644 --- a/frontend/src/routes/(root)/(logged)/user/(user)/login/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/user/(user)/login/+page.svelte @@ -106,7 +106,10 @@ } else { goto(rd ?? '/') } - } else if (rd?.startsWith('/user/workspaces')) { + // The import wizard picks the destination workspace itself, so sending it to + // the workspace picker first asks the same question twice — and the wizard + // may end in a workspace that does not exist yet. + } else if (rd?.startsWith('/user/workspaces') || rd?.startsWith('/projects/import')) { goto(rd) } else if (rd == '/#user-settings') { goto(`/user/workspaces#user-settings`) diff --git a/frontend/src/routes/(root)/+layout.svelte b/frontend/src/routes/(root)/+layout.svelte index 1f7a813eac..9d0b9aaef6 100644 --- a/frontend/src/routes/(root)/+layout.svelte +++ b/frontend/src/routes/(root)/+layout.svelte @@ -146,7 +146,11 @@ } else { if ( (!page.url.pathname.startsWith('/user/') || page.url.pathname.startsWith('/user/cli')) && - !page.url.pathname.startsWith('/oauth/mcp_authorize') + !page.url.pathname.startsWith('/oauth/mcp_authorize') && + // The hub import wizard asks for the destination itself, and may end in a + // workspace that does not exist yet — bouncing it to the picker would + // force the very choice it exists to make. + !page.url.pathname.startsWith('/projects/import') ) { goto( `/user/workspaces?rd=${encodeURIComponent(page.url.href.replace(page.url.origin, ''))}`