Repository navigation
Conversation
On a client-rendered full page load the host hands the browser no session, so the root context's session is undefined when the mount gates run. The gates read that as signed out: the authenticated mount bounced through /login, and the admin mount redirected to /login with no return path, so signed-in admins landed on /dashboard. Gates now await an optional resolveSession from the router context when the session is unresolved (undefined), and the client router supplies it from the session query. A null session is still an authoritative sign-out. The admin gate keeps the ?redirect= return path.
|
Thanks for the sharp reproduction, the failing-on-main tests, and the fix — this is absorbed into #825, which takes a different seam after design review: the mount registry drops gate kinds entirely and |
Fixes #818. Found via NEARBuilders/citynode.app#482.
On a client-rendered full page load the root context's session is still
undefinedwhen the mount gates run, so they treated a signed-in visitor as signed out. The admin gate also dropped the return path, so an admin reloading/adminlanded on/dashboard.HostContextgets an optionalresolveSession. Whensession/userare unresolved (undefined), theauthenticatedandadmingates await it before deciding. Anullsession is still an authoritative sign-out and isn't read again.resolveSessionfrom the existing session query (sessionQueryOptions), so the gate andrequireSessionshare one cached fetch./login?redirect=<path>like the session gate.Tests
tests/ui/manifest-construct.test.ts: gates await an unresolved session, trust a resolved ornullone without reading again, and the admin gate keeps the return path. The existing gate tests now await the async gate. The new gate cases fail on main.tests/ui/router-client-session.test.ts: the client router'sresolveSessionreads through and caches the session query.Checks run locally
pnpm run typecheck:packagesandbiome checkpass.tests/ui+tests/unit: all pass apart from 3 (codegen-artifact-gen,process-kill) that fail on main here too.oxlintstops locally on a config parse error innode_modules/@effect/tsgo; CI's Lint and Type Check passes.Browser: checked on a local citynode.app stack (rc.39, client-rendered
bos dev) with this branch's builtevery-pluginandeverything-devdist swapped in, signed in with a real NEAR wallet sign-in as a platform admin./admin/dashboard/admin/admin/nodes/dashboard/admin/nodes/dashboard/node/login, back to the page/admin/nodes/login?redirect=%2Fdashboard/login?redirect=%2Fadmin%2FnodesNot checked: a server-rendered deploy (that path is unchanged here).