0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/.changeset/solid-router-server-function-metadata.md
Ryan Carniato bf7f924b60
feat(solid-router): consume server-function response metadata (#8461)
* feat(solid-router): consume server-function response metadata

RouterContextProvider registers the router as the unnamed single-flight
consumer of Solid's server-function transport on the client, so the
response helpers a mutation returns take effect without the caller
wrapping the call.

redirect(): the carrier delivers an absolute target, so the soft/hard
split is a real origin comparison — same-origin navigates under the
router with replace (the destination takes the submission's place in
history), any other origin goes through navigate({ href }) so the
document reload still passes the protocol allowlist and blockers.

Route data: any declaration of a write — redirect(), reload({
revalidate }), respond(value, { revalidate }), the reserved '*' —
reloads through router.invalidate(). An empty declaration
(revalidate: []) is honored as nothing to reload. Navigation runs
before invalidation so a redirect costs one load: invalidate's load
already reads the destination as the latest location, and the
adapter's follow-up load adopts those loader flights rather than
restarting them, so the destination commits with shared layouts
reloaded and the abandoned page never reruns its own loaders (the
other order does).

X-Revalidate keys name entries in caches the router does not own and
are left to those caches' consumers.

Co-authored-by: Claude via Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* test(solid-start): expect both flight sources on the single-flight request

The router now registers as the unnamed flight-data consumer, so the
transport advertises it on the request leg under the reserved id "true"
next to Start's "tsr". The response still folds only "tsr".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude via Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Brenley Dueck <brenleydueck@Brenleys-Mac-mini.local>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 12:16:20 -05:00

1 KiB

@tanstack/solid-router
patch

Consume Solid server-function response metadata. RouterContextProvider registers the router as the transport's unnamed single-flight consumer on the client, so the response helpers a mutation returns take effect without the caller wrapping the call: redirect() navigates — same-origin targets softly under the router with replace, other origins through a document navigation via navigate({ href }) so the protocol allowlist and blockers still apply — and any declaration of a write (redirect(), reload({ revalidate }), respond(value, { revalidate }), the reserved revalidate: '*') reloads route data through router.invalidate(). An empty declaration (revalidate: []) is honored as nothing to reload. Navigation runs before invalidation so a redirect costs one load: the destination commits with its shared layouts reloaded and the page being left never reruns its own loaders. X-Revalidate keys name entries in caches the router does not own and are left to those caches' consumers.