Skip to content

fix(serverRouteComponent): hand a bare GET preload's call to the render - #682

Merged
ryansolid merged 1 commit into
nextfrom
claude/project-thread-6h93rx
Oct 13, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/project-thread-6h93rx

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Before: on a route with a bare GET(fn) source in serverRouteComponent, a link's preload and the render that followed it each sent the same request. Even with #680, a click sent two identical GETs, and with no-store the browser ran them one after the other.

After: the render mounts the call the preload already started, so one visit sends one request.

The preload's result is handed to the next render with the same args, once, within the same 5 s window query() gives a preload. A later visit calls fresh, as a bare GET always does. Concurrent preloads of the same args share one call. A failed preload isn't handed on, so the render retries. query() and liveQuery() sources, plain functions and the server render are unchanged. Because each result reaches exactly one render, a frame stream is never mounted twice, which answers the open question in the issue.

How: handOffPreloads in src/serverRouteComponent.ts wraps the source once, so it covers both preloadRoute's server.call and the render's call. It tells them apart by getIntent() === "preload", and keys by JSON.stringify(args).

Closes #677.

Testing

  • Added four specs in test/server-routes.spec.tsx under "a bare GET source". Two of them fail without the fix.
  • pnpm test: 700 + 96 server specs and types all pass
  • pnpm build: clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01V4hL2itq3ojS2Wy1acXctX


Generated by Claude Code

…er (#677)

A bare GET(fn) source has no cache, so a link preload and the render it
warmed each sent the request. Keep the preload's result for the next
render with the same args (once, within query's preload window), share
it between concurrent preloads, and drop it when it fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V4hL2itq3ojS2Wy1acXctX
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5943f7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

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

@ryansolid ryansolid self-assigned this Oct 13, 2026
@ryansolid
ryansolid merged commit 4a1685e into next Oct 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants