refactor(solid): retire solid-router-ssr-query — native channels carry the Router + Query pairing - #8193
Conversation
…els carry the Router + Query pairing solid-query v6's QueryClientProvider serializes the request's cache into Solid's hydration registry during SSR and primes the client cache from it, so running the ssr-query transport alongside it ships every query payload twice. The package's two runtime conveniences are each a few lines of userland composition on public APIs: the provider wrap via the router's Wrap option, and cache-driven redirect() errors handed to router.navigate from the caches' config.onError. Converts the three Solid Start e2e apps to the composition (all suites green, including the redirect-from-query tests) and marks the package deprecated for the v2 line. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 74435de
☁️ Nx Cloud last updated this comment at |
|
I'm on board with this. Would be one less package to maintain.
That doesn't seem ideal |
Hooray! CodSpeed harness just leveled up!The base and head of this comparison were measured with different runner settings, so their benchmark values are not directly comparable. What changed between base and head:
Re-run the base with the same settings to get a valid performance comparison. Comparing Footnotes |
Draft — for discussion. Works against published packages today (
@tanstack/solid-query@6.0.0-rc.1,solid-js@2.0.0-rc.4); all three converted e2e suites pass.Summary
On the Solid v2 line,
@tanstack/solid-router-ssr-querybundles three unrelated things, and each now has a better home:router-ssr-query-core's dehydrate + query stream + client hydrate). Native to solid-query v6:QueryClientProviderserializes the request's cache into Solid's hydration registry (content-addressed by query hash, promise-valued at fetch-dispatch so pending queries stream, covering never-mounted loader prefetches) and primes the client cache from it. Running the package alongside it ships every query payload twice — which is what the e2e apps were doing: once through the router's dehydration stream, once through the hydration registry.wrapQueryClient. A JSX expression — the router's ownWrapoption:handleRedirects. Runtime navigation glue, not an SSR concern: cache-driven fetches (mount fetches, background refetches, mutations) run outside the router, so aqueryFn/mutationFnthrowingredirect()needs handing torouter.navigate. That's a small userland composition of public APIs on both sides —isRedirect/resolveRedirectfrom the router,config.onErroron the query/mutation caches (seerouteCacheRedirectsin the converted apps). Loader-driven redirects were never the package's: they propagate through the loader and the router handles them on both sides.This PR converts the three Solid Start e2e apps (
basic-solid-query,server-functions,server-routes) to the composition, removes the dependency, and marks the package deprecated for the v2 line in its README.Verification
basic-solid-query: 6/6 — SSR hydration, nested layouts, suspense transitions, query-preserving navigation, all on the native transport only.server-functions: 29/29 — includingredirect-test(mount-time query redirect via theonErrorglue) andredirect-test-ssr(render-time query redirect resolving through the stream handler), demonstratinghandleRedirectsis fully replaced.server-routes: 2/2.Notes
fullstack-tanstack(bare vite + TanStack Router + Query, no Start — solid-v2/fullstack-tanstack: multi-source single-flight solidjs/templates#287), which is the point: none of it is Start-specific.loadFlightTarget): this PR is the SSR/read side going native, that one is the mutation/write side. Together they remove the need for any*-ssr-querypackage on Solid.docs/router/integrations/query.md's Solid tab still shows the old setup — happy to rewrite it once there's agreement on direction.router-ssr-query-coretransport remains correct for frameworks without a native serialization channel.Made with Cursor