Repository navigation
Use server components for docs and the homepage - #258
Open
brookslybrand wants to merge 4 commits into
Open
brookslybrand wants to merge 4 commits into
brookslybrand wants to merge 4 commits into
Conversation
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
October 8, 2026 14:01
0fb574c to
29754bd
Compare
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
October 8, 2026 14:55
29754bd to
31c8927
Compare
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
October 8, 2026 17:02
31c8927 to
7cced18
Compare
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
October 19, 2026 18:31
7cced18 to
2fba914
Compare
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
October 20, 2026 20:39
2fba914 to
7057de5
Compare
Replaces the /color-scheme route action with a "use server" function to exercise server functions in RSC Framework Mode. It works without JavaScript through React's progressive enhancement, and the theme still switches instantly on submit. The server function sets the cookie by registering a replace() redirect back to the current page. React Router doesn't let server function redirects keep the scroll position, so switching themes now scrolls to the top.
Instead of redirecting back to the page to set the cookie, the server function records the new color scheme for the request. Root middleware sets the cookie on the response, and the root loader returns the new value when loaders reload after the server function, so there's no navigation and the scroll position is kept. Without JavaScript, the server function still redirects so a refresh doesn't resubmit the form.
React Router 8.5.1 no longer duplicates headers when a server function throws a redirect (remix-run/react-router#15665), so use the standard throw form.
brookslybrand
force-pushed
the
unstable-rsc-framework
branch
from
November 3, 2026 19:32
a59f818 to
a4f8a4c
Compare
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.
Builds on #259, which is now on React Router 8.5.1. #259 handles the RSC migration and its workarounds. This PR moves the docs and homepage to server components.
Staging still runs an older 8.4 build and hasn't been redeployed for 8.5.1.
Try it on staging.
Server components
"use client"components.Homepage stats
<Suspense>boundary is created in the loader. If the boundary lived in the route component instead, the whole RSC payload would wait on stats.--,---,---) sized to the last known numbers, so the layout doesn't jump.Search
React.lazywhen search is opened, instead of up front.@docsearch/reactpulls in the modal, so the search button and keyboard shortcut hook are now our own code. The button keeps the original icon and markup.Color scheme
AsyncLocalStorageslot. The middleware then sets the cookie and loaders reload in place, which keeps the scroll position. Server function redirects can't passpreventScrollReset.throw replace(...)back to it. React Router 8.5.1 fixed duplicate headers on thrown server function redirects (RSC: throwing a redirect from a server function sends its headers twice react-router#15665), so this now uses the standard throw form.Tests
I clicked through navigation, active links, copy buttons, theme switching, and search on staging, and checked HTML, Flight, and Markdown responses.
One caveat: RSC adds its own client runtime, so this isn't automatically less JS overall. Most of the initial-load savings come from lazy-loading search.
Validation on 8.5.1: build, typecheck, lint, and all 100 tests pass. Production-build smoke checks pass for HTML, bot HTML (stats render server-side, with the placeholder only in the Flight payload), Markdown, Flight, HEAD, and 404s. Client-side navigation, the server-function theme toggle (with and without JavaScript, single
Set-Cookie), and hydration show no browser errors.Generated by an AI agent on behalf of Brooks Lybrand. Model: Claude Opus 5.5; reasoning: unknown.