Repository navigation
v2142: Render the workspace sidebars from root loader data - #1758
Merged
Merged
Conversation
Contributor
|
Preview |
nicu-chiciuc
had a problem deploying
to
preview
October 21, 2026 12:55 — with
GitHub Actions
Failure
The root loader now reads the saved workspace sidebar state, the right sidebar's organizations, consent prompts, and repository list as the user, next to the viewer and its access. The shell's Convex controller starts from that state, so the server HTML has the saved pane widths, open state, and mobile pane. The right sidebar and the organization control read the same TanStack cache and stay live through its subscriptions. The local storage controller, its mirror of the Convex state, the controller switch, and the app's prehydration scripts are deleted. A visitor without a session gets the default widths. The visual fixture route keeps an in-memory state that visual tests seed under their own key. Repository pages declare their left pane in route static data, and the shell renders it from the rendered route matches in the same render as the page, so the server HTML has the repository tree. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Before React measures the viewport, SidebarLayout now writes the mobile pane widths, the main pane width of a merged surface, and the merged-side attribute from its controller state. The widths are CSS expressions of the carousel width with the clamps of the measured geometry, and a saved right pane aligns the carousel content to its end until React scrolls to it. The first paint on a phone then shows the saved pane without a script. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The agent browser handoff fragment script and the public landing logo script now live in their own source files. A small Vite plugin compiles each one, for `?inline-script` imports, into the source of a function expression that the server bundle carries as a string. The Convex CLI's esbuild keepNames pass no longer reaches inside them, so the page no longer throws on its `__name` helper. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A desktop pane that appears with a render, such as the repository tree when a navigation opens a repository page, no longer gets the width transition in that render. React inserts the pane before it sets the carousel's width variables, so the transition animated the tree from 0 to its width and pushed the page across over 150 ms. Co-Authored-By: Claude Fable 5.1 <[email protected]>
next-themes renders a second copy of the root head's theme script from Function#toString, which the Convex CLI's keepNames pass breaks in the server bundle, so every server-rendered page threw on the `__name` helper. A non-JavaScript script type keeps that copy from running; the head script, which now also sets color-scheme, applies the theme before the first paint. The root unit test project compiles `?inline-script` imports with the app's plugin, so the tests run the same compiled head scripts. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The desktop width variables move from the carousel to the pane elements, so a pane that a render inserts has its width in its first style. This replaces the render-time ref that skipped the transition for a new pane: the browser no longer sees the pane at width 0 before the carousel update, so there is nothing to animate, and no ref is read during render. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Visual tests on live routes now save the sidebar state of their account in Convex after the sign-in, since the app no longer reads a local copy. The right sidebar tests that share the seeded account run in order, and the signed-out tests open and resize the panes through the page. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The sidebar layout specs now describe the current contract: the server markup carries the controller state, Samebase starts the controller from the root loader's saved state and renders no inline sidebar script, and the package prehydration builders stay for browser-only consumers. The tracked file list is regenerated for the added and deleted files. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Before React measures the viewport, the desktop pane widths are now CSS fits of the saved widths with the rules of getDesktopPaneWidths: a sidebar keeps its saved width while the main pane keeps its minimum, and two open sidebars that do not fit share the free width. A saved mobile merge shows only when the main pane keeps its 214 px minimum next to the side pane; a clamp adds the side width back otherwise. Saved widths from a larger screen no longer cover the page until hydration. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The Convex query client subscribes to every Convex query in the cache that is not skipped, even a disabled one, so public pages subscribed to the protected organization list and got authorization errors. The provider now skips the viewer access and organization queries until the route and the access need them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The right sidebar visual tests that save a sidebar state sign up an approved account of their own, so they no longer change the shared seeded account that tests in other files read. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Two tests that started in the same millisecond signed up the same email. The accounts now use a random email of the seeded email's length. The minimum mobile right pane baseline shows the member account of the test, which has no admin links. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The session-recording test clicked the server-rendered "No thanks" button before the page hydrated, so the choice did nothing and the next prompt never appeared. The test now waits for the measured viewport, which the layout marks after hydration, and the test accounts use digit-only random emails so the masked account row wraps the same way in every run. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A page rendered without a session (a prerendered public page, or a server render for a visitor without one) keeps its sidebar state in local storage again, under the old key and envelope, and writes every change. An inline script after the layout applies the stored desktop widths, open state, and mobile pane before the first paint. The build compiles it through the inline-script plugin from the package's prehydration functions, so no function is serialized at run time. The local controller installs the stored state in its layout effect at hydration and removes the temporary stylesheet once a commit rendered that state. A page rendered as the user keeps the Convex state from the root loader and renders no script. The root route records which render created the document, and a page keeps that source until the next document load. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A browser paints a long page before it has parsed all of it. The right pane's markup comes after the main pane's content, so the main pane took the full width and narrowed when the right pane arrived. The carousel now carries the right pane's desktop width and keeps that space until the right pane is parsed. On a phone, the saved main pane showed the left pane at width 0 and then scrolled past it after hydration. The left pane now has its width from the first paint and sits out of view with a negative margin until React measures and scrolls to the same position. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The build's prerender has no session, so the right sidebar and the landing account section said "checking login" until the browser settled the session. The root loader now reads the deployment's sign-in methods on every server render without a token, the prerender included, and NotSignedIn renders the signed-out content for a render without a session. The static HTML carries the final sign-in box, with the password form only where the deployment allows it. SessionPending had no other place that cannot know, so it is deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The spec loads the site that the local Convex backend serves, through a proxy that sends HTML in 16 KB chunks 100 ms apart, so the browser paints while it parses. Every pixel that a painted frame shows with content must look the same once the page has settled. Only the hero logo canvas is masked, and the YouTube embeds get an empty document. It covers the signed-out landing page on a desktop and a phone, the signed-out agent connect page, and the signed-in dashboard with a saved 360 px right sidebar on a desktop and a phone. The agent connect page rendered "Connecting Samebase..." on the server, which cannot see the handoff fragment, and changed it in place for a visit without a handoff. It now shows no status until the browser has read the handoff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The build-time sign-in policy query failed every build of a new deployment: the build runs before the deployment's first push, so the query has no function to call. The CI checks job, the Linux visual wrapper, and the first push of each pull request preview start from a new deployment. The prerender again renders the sign-in box without the policy. Server renders without a session still read it. The OAuth buttons now stay centered when the password form renders, so on local and preview deployments the form appears below them once the policy loads, and nothing moves. Production has no password form. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The spec now starts at the last frame at or before the first-paint entry, because the first paint's frame can carry an earlier timestamp. A later frame counts when it stays on screen for 50 ms: around hydration, Chromium on macOS can raster a few glyphs differently for a single frame, which moves nothing. The first painted frame always counts. The auth controls box keeps its full width in both states, so the layout-shift API also reports nothing when the password form appears. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The GitHub button now stays centered when the local password form renders below it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The landing page's server HTML has the sign-in box, so the sign-up toggle can be clicked before hydration, when it does nothing. The settings test now uses the same retrying helper as the organization acceptance flow. The settings page also mounts its own layout, which scrolls the carousel to the saved pane once it has measured the viewport, so the test waits for that before it scrolls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The auth controls box now has the account section's width, so at the 130 px minimum pane the GitHub button is 122 px wide and stays inside the section instead of 138 px wide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
nicu-chiciuc
force-pushed
the
nicu-sidebar-ssr-state
branch
from
October 21, 2026 14:45
fc9d4c6 to
126d9cc
Compare
nicu-chiciuc
added a commit
that referenced
this pull request
Oct 24, 2026
* Update the public sidebar baseline for the centered GitHub button PR #1758 (v2142) centered the OAuth buttons so the local password form appears below them without moving them, and updated the MCP consent snapshot. The public legal route sidebar snapshot still showed the left-aligned button, so main CI failed on it with a 0.04 pixel ratio. The new Linux baseline matches the image the main CI runner rendered pixel for pixel. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Move between landing FAQ questions with Tab PR #1755 (v2139) updated @base-ui/react from 1.4.1 to 1.9.0. Base UI 1.6.0 removed arrow-key focus movement between accordion triggers, following the current APG accordion pattern (mui/base-ui#4965), so ArrowDown no longer moves focus to the next question. Each trigger stays in the tab order, so the test now presses Tab. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Wait for the trailing-newline diff fixture before counting The test counted the fixture URL once right after networkidle, with no wait. The client-only visual fixture route shows its pending screen first, and TanStack Router keeps a shown pending screen for its 500 ms defaultPendingMinMs, so the fixture mounts after networkidle and the count was 0. With pendingMinMs 0 the fixture mounted before networkidle. The test now waits for the URL text to be visible, like the test above it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since v2137 the app renders signed-in pages on the server, but the right sidebar on
/repostill moved after load. Measured on the local Convex site (the deployed server bundle on the local backend), Chromium 1440x900, signed in, 2 cold and 2 warm loads per case:The 5 page errors were
ReferenceErrorfrom inline scripts built withFunction#toString: the Convex CLI bundles the server build again with esbuildkeepNames, which adds__namecalls that the page does not have. Four were the app's (two sidebar prehydration scripts, the agent browser handoff script, the landing logo script) and one was next-themes' theme script.Design
viewerandviewerAccess, with the sameconvexQueryand dehydration. The Convex controller starts from that data, never from the hard-coded default; writes still go throughsetWorkspaceSidebarStatewith the existing debounce. This is the only source on a page rendered as the user: no local storage and no script.OrganizationContextProviderand the right sidebar read them from the TanStack cache under the same keys, and the subscriptions keep them live. Routes and viewers that do not need the organizations skip the queries ("skip", because the Convex query client subscribes to disabled queries too)./repo/$owner/$repositoryand its settings page) declare their left pane in route static data. The shell reads the rendered route matches and renders that pane in the same render as the page, so the server HTML has the repository tree.RepositoryDashboardno longer registers a left pane in a layout effect.SidebarLayoutrenders its state as markup with no script: desktop widths as CSS fits of the saved widths to the carousel (the rules ofgetDesktopPaneWidths), the mobile pane and merged side as attributes, mobile widths as CSS clamps, a merge only when the main pane keeps its 214 px minimum, and a saved right pane by aligning the carousel content to its end until React scrolls to it.apps/samebase/dev/inlineScriptPlugin.ts) compiles each?inline-scriptimport with Rolldown into a string that the server bundle carries, sokeepNamescannot reach inside. The root unit test project uses the same plugin, so the existing VM tests run the compiled scripts.typethrough itsscriptProps; the root head's own theme script (a plain string) already applies the theme before the first paint and now also setscolor-scheme.No-session path
A page rendered without a session (a prerendered public page, where the build has no visitor, or a server render with no session token) keeps the sidebar state in local storage, as before this PR, so a signed-out visitor keeps the open state and width of a sidebar, and on a phone the open pane, across reloads.
samebase_app_workspace_sidebar_stateand envelope, so existing visitors keep their state. The local controller (useLocalWorkspaceSidebarState.ts) writes every change.prehydrateSidebarLayoutDesktopandprehydrateSidebarLayoutMobilePane. The build compiles it with the?inline-scriptplugin, so no function is serialized at run time and the__nameerror cannot return./agents/connect.DocumentRenderedWithSessionContext). A page rendered as the user never renders the script, and a page keeps its source until the next document load, so the Convex state and the local copy never meet on one page.Why not one source: the server cannot read a signed-out visitor's state, and a prerendered page has no visitor at all, so local storage and a pre-paint script are the only way to show that state on the first frame.
Landing first paint
The signed-out landing page moved on cold loads, on the preview and on production. Two mechanisms:
structure.csskeeps that space with a::afterbox until the right pane is parsed (:has()). On a phone, the left pane has its width from the first paint and sits out of view with a negative margin, so the scroll to 240 at hydration changes nothing on screen./without a session, andSessionPendingrendered "checking login" until the browser settled the session.NotSignedInnow renders the signed-out content for every render without a session, so the static HTML has the final sign-in box.SessionPendingis deleted: no other place needs it. A signed-in visitor on a static page sees the sign-in box until the session settles (accepted).The prerender does not read the deployment's password policy. A build-time query failed every build of a new deployment, because the build runs before the deployment's first push (the CI
checksjob failed on this branch, and the first push of each PR preview would fail too). The static HTML has the sign-in header and the GitHub button; on local and preview deployments, the password form appears below them when the policy loads, and the buttons now stay centered in both states, so nothing moves. Production has no password form, so its static HTML is final./agents/connectrendered "Connecting Samebase..." on the server, which cannot see the handoff fragment, and replaced it with "Connection link unavailable." for a visit without a handoff. It now shows no status until the browser has read the handoff.Harness: the local Convex site through a proxy that sends HTML in 16 KB chunks 100 ms apart (production-like cold loads; Chromium throttling also delays the render-blocking CSS, so the first paint then waits for the whole document), signed out,
/, 2 cold loads each:HTML of
/: 149.4 KB on this branch, 156.5 KB on main. About 82.4 KB is the hero logo's static image (a URL-encoded SVG data URI, shown until WebGL renders), 21.6 KB class attributes, 12.5 KB inline scripts (8; main has 21.8 KB in 9; the largest is the no-session sidebar script, 7.4 KB), 7.1 KB inline SVG icons, 5.6 KB dehydrated router and query state, 4.8 KB text, and about 15 KB tags, other attributes, and head metadata. Nothing in it is clearly dead, so this change removes nothing.Test
apps/samebase/e2e/first-paint-stability.spec.tsloads the built site that the local Convex backend serves, through the chunking proxy, and records the screencast. The first painted frame, and every later frame that stays on screen for 50 ms, must match the settled frame wherever it painted content; content may appear where a frame showed only the background. Only the hero logo canvas is masked; the YouTube embeds get an empty document so the test does not depend on YouTube. Cases: signed-out/on a desktop and a phone, signed-out/agents/connect, and signed-in/repowith a saved 360 px right sidebar on a desktop and a phone. It runs in the Linux wrapper like the other specs:Against main's build (the signed-out cases; main has no
saveWorkspaceSidebarStatehelper), it fails on both landing mechanisms:The 777 and 886 ms lines are the main pane at full width (mechanism 1). The 1059 and 2434 ms lines are "checking login" and its replacement by the sign-in box (mechanism 2). The phone landing case passes on main: its first frame already shows the same pixels as the settled one. On this branch, all 5 cases pass: 20 of 20 local runs, and in the Linux wrapper.
Deleted
useLocalStorageWorkspaceSidebarState.ts(317 lines) and its test (376 lines), replaced by a 59-line local controller for pages without a session.appWorkspaceSidebarPrehydration.ts(128 lines oftoStringscripts), the mirror into local storage, and the controller switch on a signed-in page.AppWorkspaceShell.test.tsxthat tested the prehydration scripts and the local copy.SessionPending.tsx:NotSignedInrenders the signed-out content for every render without a session.workspace-frame-geometry.spec.ts: the visual fixture route keeps in-memory state that tests seed under their own key.packages/sidebars' prehydration builder stays:apps/sidebars-examplestill uses it. Specs 087, 094, and 097 describe the new first-paint contract.Verification
Same harness and site after the change (sidebar layout-shift entries, page errors, first paint against final pane geometry):
/repo, saved 288/repo, saved 360 in Convex/repo, saved 360, no local copy/(prerendered), right sidebar resized to 360/, right sidebar resized and closed/agents/connect(server render), resized to 360* On
/, the local password form appears below the GitHub button when the deployment's sign-in methods load, which a prerendered page does not have. The auth controls keep their width, so this adds no shift entry. Production has no password form. Signed-in results after this change: 0 entries at 288, at 360, and at 360 with no local copy, 4 loads each.Navigation (signed in,
/repoto a repository page and back, then/settingsand back): the 150 ms slide-in of the repository tree is gone (it gave 7 shift entries). 4 sidebar shift entries remain, all in the frame of the click, with the same values as on main: the right sidebar's content differs per page (the organization links of a repository page, no organization control on/settings, the current-page highlight box). Going back from a repository page with the tree open to/repomoves the main pane by the tree's width, because/repohas no left pane.pnpm exec vp check: 0 errors.vp test --project unit apps/samebase/src packages/sidebars): 1289 passed.pnpm test:visual:linux --with first-paint-stability, app-right-sidebar-visual, organization-context-visual, workspace-sidebar-visual, repository-overview-v2-visual, settings-page-visual, public-landing-shell, public-account-loading-visual, landing-markdown-preview-visual, file-view-pane-selection, workspace-frame-geometry, workspace-sidebar-drag): 83 passed, 1 failed. The failure,landing preview FAQ answers the direct-agent questions(an accordion focus check), also fails on main CI (run 39574893167).mcp-consent-sign-in-no-left-sidebar.png(the GitHub button stays centered above the local password form) andapp-right-sidebar-github-button-mobile-min.png(at the 130 px pane, the button is 122 px wide and stays inside the account section instead of 138 px). The mobile settings test now waits for hydration before the sign-up toggle and for the settings layout to measure before it scrolls.app-right-sidebar-mobile-right-pane-min.pngis updated because that member account has no admin links.Not verified
/,/docs/*,/pricing) gets the local copy on that page, because the build renders those files without a visitor; the Convex state applies on the next page that the server renders as the user./repo/$still registers its left pane in a layout effect; this change covers the repository dashboard and settings pages.🤖 Generated with Claude Code