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:
@@ -26,6 +26,20 @@ export const isOffscaleSection = (value: string | undefined): value is OffscaleS
|
||||
/** The one place the section URL is spelled, so the nav, the guard and any deep link cannot drift apart. */
|
||||
export const offscaleSectionPath = (id: OffscaleSectionId) => `/offscale/${id}`;
|
||||
|
||||
/**
|
||||
* A request, in the URL, to open the registration form.
|
||||
*
|
||||
* The server picker's "Register a server" used to be a plain link to the Servers section — which renders
|
||||
* identically at `/offscale` and `/offscale/servers`, so clicking it changed the URL and nothing else and
|
||||
* read as a dead control. Three things on that screen carry this label; this is what makes the first one
|
||||
* do what the other two do.
|
||||
*
|
||||
* It is a one-shot flag rather than addressable state: ServersView consumes it and strips it, so closing
|
||||
* the form and clicking again works, and a reload does not reopen a form you dismissed.
|
||||
*/
|
||||
export const OFFSCALE_REGISTER_PARAM = 'register';
|
||||
export const offscaleRegisterPath = () => `${offscaleSectionPath('servers')}?${OFFSCALE_REGISTER_PARAM}=1`;
|
||||
|
||||
/** A registered Headscale server. The API key is never included — it stays encrypted in Postgres. */
|
||||
export type OffscaleServer = {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user