Repository navigation
Move workspace page checks from server loads into queries - #282
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 92f660b | Nov 22 2026, 11:17 AM |
f43aa40 to
1630b08
Compare
A server load makes every client navigation fetch __data.json before the page's queries start. Workspace pages used loads only to set the cache header, read URL parameters, check permissions, return 404s and redirect. The request hook now sets private, no-store on every HTML response, so Back after sign-out asks the server again. Checks and redirects run in the queries, saved notices come from form results, an app path matches only a UUID, and getAppDetails provides the rollback request ID.
1630b08 to
92f660b
Compare
Comments Outside DiffThese findings could not be posted inline.
|
|
The reserved slugs and the routes they collide with come from #283; this PR does not change them. Handling existing organizations with such slugs is out of scope here and will be decided separately. |
On client-side navigation, a page with a server load first fetches
__data.json. Its component starts its queries only after that response arrives, so each click waited for two server requests in a row. Most workspace pages had a server load that only set a header, read URL parameters, checked a permission or returned a 404. This moves that work into the queries the pages already call, following the remote functions docs (getPostwitherror(404),redirectin queries,form.resultinstead of a redirect).Changes
handlesetscache-control: private, no-storeon every HTML response. Before, only pages with a load sent it, and only because each load set it. Without it, the browser's Back button shows a private page again after sign-out (RFC 9111, section 6). SvelteKit already sendsno-storeon__data.jsonand remote function responses. A new browser test signs out and goes Back. Without the hook header, it fails.q,filter,pageanderrorfrompage.url, and route parameters fromparams.getAgentsreturns 403 to non-administrators. The API still lists agents for app creators.getAppCreation: creator check and preview originalgetServiceListAppgetServiceAvailability: administrator check and 404getServiceConnectiongetConnectionResultgetConnectionRequestcheckSsoSetup: redirect when SSO is activegetWelcome: administrator redirect[appId]became[appId=identifier]. A matcher insrc/params.tsreplaces the load's 404 for an ID that is not a UUID. Such a URL no longer matches a route, so it gets the root 404 page, as an unknown organization slug already does.getAppDetailsreturns a freshrequestId. The value is serialized with the query result, so the server-rendered form and the hydrated page share it. As before, the layout keeps the submitted ID until a rollback succeeds, so a retry is recognized as the same request.?saved=1,?accessSaved=1or?invited=1. Without JavaScript, SvelteKit renders the page with the form's result. Inviting and setting availability always redirected before, even with JavaScript.Remaining workspace loads:
[organization]/+layout.server.ts: its 404 runs again only when the organization changes./settingsredirect.Trade-offs without JavaScript
These apply only when a form is submitted without JavaScript.
#accessor#app-accesssection.Measurements
Client navigation with 250 ms of added latency per server data request, median of rounds two and three,
mainvs. this branch:main__data.json, thengetCatalog)getCatalog)__data.json, thengetApps)getApps)__data.json, thengetApps)getAppCreation)__data.json, thengetAppAccess)getAppAccess)__data.json)__data.json, then two queries one after another)__data.json, thengetMembers)getMembers)__data.json, thengetSettings)getSettings)__data.json, thengetUserConnections)getUserConnections)Validation
pnpm checkPreserve working Home addresses for existing organizations with reserved slugs before merging.
Summary
The PR removes page loads and moves workspace addresses and queries to an explicit organization.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["Workspace URL with organization slug"] --> B["Request hook checks membership"] B --> C["Workspace query resolves organization"] C --> D["Page queries receive organization ID"] D --> E["Remote function checks membership"] E --> F["Server operation checks resource access"]Reviews (3) · Last reviewed commit: "Move workspace page checks from server l..." · Reviewed by Greptile