the picker's register link opens the form

reported as "I click register a server and nothing happens", and nothing was broken. three controls on
that screen carry the label. two are buttons that open the form; the one in the server picker — top left,
where you look first — was a plain <Link> to the servers section.

/offscale and /offscale/servers render the same view (useOffscaleSection defaults to servers when there is
no param), so from either one the click navigated to something identical. the URL moved and nothing else
did, and the only visible result was a second button with the same label further down the page.

so the link now carries ?register=1 and ServersView consumes it. the flag is stripped with replace on the
way in, which is not tidiness: left in the URL, closing the form and clicking the picker again would be a
navigation to the URL already showing, and nothing would happen — the same bug, restored.

ServersView.test.tsx pins all three: the form opens on arrival, the flag is consumed, and no flag means no
form. removing the effect fails the first two.
This commit is contained in:
2026-08-17 12:58:47 +00:00
parent 373d67e0a0
commit 58fbf12e4b
4 changed files with 124 additions and 3 deletions
+6 -2
View File
@@ -1,6 +1,6 @@
import { Check, Network, Plus } from 'lucide-react';
import { Link } from 'react-router';
import { offscaleSectionPath } from './shared';
import { offscaleRegisterPath } from './shared';
import { useOffscaleServers } from './useOffscaleServers';
// Top-left panel of the /offscale workspace: which server everything else acts on.
@@ -45,9 +45,13 @@ export const OffscaleServerPicker = () => {
</button>
))}
{/* Goes to the Servers section AND opens the form. A link to the section alone was a no-op from the
place you are most likely to be standing: `/offscale` and `/offscale/servers` render the same
view, so the navigation was invisible and the only visible result was a second button with the
same label. */}
{servers.length === 0 && !isLoading && (
<Link
to={offscaleSectionPath('servers')}
to={offscaleRegisterPath()}
className="flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<Plus className="h-3.5 w-3.5 shrink-0" />