fix: let the import wizard survive sign-in and a missing workspace

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) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-08-17 18:36:55 +02:00
parent 7f8053721b
commit 00437e9500
3 changed files with 16 additions and 3 deletions
+7 -1
View File
@@ -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`)
@@ -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`)
+5 -1
View File
@@ -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, ''))}`