Repository navigation
Conversation
🦋 Changeset detectedLatest commit: f4607e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
brenelz
marked this pull request as ready for review
November 24, 2026 02:44
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.
Link claims still cost a measurable share of page time on pages with many links, even after #701. On the framework-tracker
/server-side-renderedpage (1000 row links to/server-side-rendered/<id>), turning the server claim handler off entirely raises SSR throughput by about 21% on a Linux runner. On the client-rendered/client-side-renderedpage, the client claims spend about 4.5 ms of the 22 ms of page-load JavaScript concluding that each of the 1000 links is inactive. Separately, client builds shipplainHrefand its regex even though only server claims call it.Root cause
setupServerLinkClaimssends every anchor throughmanagedLinkUrl(attribute normalization,plainHref,isUnderBase) and then through the location matcher. On the client,setupLinkClaimsdoes the same for every claimed anchor throughrefresh:new URL(href, document.baseURI),isUnderBase, thencomparablePathin the matcher. On a list page almost none of those links can be active. A link is only active when its path equals the location or is a parent of it, so any href longer than the location, or one that is not a prefix of it, can never match.The client size issue comes from how the bundler splits chunks. It fixes a shared chunk's cross-chunk exports before the minifier removes the
isServerbranches, so a server-only call inclaims.tskeeps theutils.tsfunction it imports alive in the client's routing chunk.What changed
locationMisses(router)insrc/claims.tsreturns a check that is true for a root-relative href made of letter, digit,_and-segments (/^(?:\/[\w-]+)+$/: no dot or empty segments, no trailing slash, nothingURLwould rewrite) that is longer than the comparable location or is not a prefix of it. Such an href's comparable path is just its lowercase form, so this is exactly the matcher's rule:loc === pathneeds equal length, andloc.startsWith(path + "/")needs a longer location. The comparable location is recomputed only whenrouter.location.pathnamechanges.""for a miss before building the attrs object.apply(linkState(a))for a miss when there is no links plugin, the record does not own anaria-current, and the anchor has nodata-active. In that caseapplywould change nothing. The check sits inrefresh, so it covers the first claim, re-claims after anhrefwrite, and the location-change sweep. The anchor still joins the registry, so a later navigation that makes it active updates it. The check runs inside the existinguntrack, so it adds no subscription to the creating computation.utils.tsexportsserverPlainHref(isServer ? plainHref : undefined), andclaims.tscalls that instead of importingplainHrefdirectly. In client builds the binding folds toundefined, so neither the function nor its regex ships.plainHrefstays exported for the server fuzz test, which does not affect app bundles.Rendered HTML is unchanged. On the tracker page it is identical to
mainonce per-request UUIDs and asset hashes are stripped. Link attributes after load are identical on both tracker pages.Verification
pnpm test: 770 client tests, 112 server tests andtest:typespass.A fuzz test in
test/server/plain-href-fast-path.spec.tschecks 100,000 random href/location pairs (mixed case,./..,%41, trailing slashes, queries, hashes). No href thatlinkMatchermarks active or current is ever reported as a miss. Fixed cases cover both outcomes.test/claims-plain-miss.spec.tsxcountsURLconstructions on the client. On this branch, 20 unrelated links parse fewer than 5 URLs at claim and fewer than 10 across a navigation; the same test on the server-only commits parses 45. It also checks that the location and its parents are still marked, base paths, the fallback for a query, hash,%,..,//, trailing slash, relative and backslash href, that a links plugin turns the skip off, that a later navigation marks a skipped link, and that staledata-activeor router-ownedaria-currenton a miss is still cleared while an authored one is kept. jsdom here cannot hydrate or resolve SVGhref.baseVal, so those paths are not covered.SSR throughput on Linux: ubuntu-latest (AMD EPYC 7763), with the tracker's
app-solidbuilt against router tarballs packed frommain(7347290), the first commit of this branch, andmainwith the claim handler returning""at once. The server runs innode:24.22.1-bookworm-slimpinned to CPUs 0-2, and autocannon in a second container on CPU 3. Each run is 10 connections, a 10 s warmup and a 20 s measurement, over six interleaved rounds:mainThe early exit recovers about 73% of the throughput the claim handler costs on this page.
Instructions retired per request, measured in-process with
handleRequeston macOS arm64 (/usr/bin/time -l, three interleaved rounds, after a 200-request warmup with the warmup cost subtracted):main41.8M–42.2M, first two commits 38.9M–39.0M (about −7%), claim handler off 35.8M–36.9M.Client page load on
/client-side-rendered(minified build, headless Chrome 158 on an M2, CDP Profiler duringgoto, 16 loads per side, interleaved): page-load JS goes from a median of 22.3 ms (21.7–23.1) on the second commit to 17.9 ms (16.8–18.3) with the third. FCP median goes from 48 to 44 ms over 30 loads each, one 4 ms frame step.Client JS on the tracker app (17 chunks,
@solidjs/web2.0.4):main142,416 B minified / 48,990 B brotli, this branch 142,401 / 48,921 (−15 / −69). DroppingplainHrefsaves 313 B minified; the server and client early exits together add 298 B.Open
.,~and other charactersURLkeeps verbatim. The third commit narrows it to letter, digit,_and-segments, which keeps the shared check out of the client's routing chunk. Hrefs such as/docs/v1.2or/file.pdfnow take the full path on the server. The tracker's links still match, and I have not re-measured the server after this change.🤖 Generated with Claude Code