solid-v2/fullstack-tanstack: multi-source single-flight - #287
Draft
ryansolid wants to merge 2 commits into
Draft
Conversation
Solid's single-flight channel is becoming multi-source (solidjs/solid 653dd41e) and solid-query internalizes the client half (TanStack/query#11326): QueryClientProvider subscribes the query cache's consumer under FLIGHT_DATA_SOURCE ("sq") itself. The template drops its hand-rolled client wiring (subscribeFlightData + hydrate in App.tsx) and registers the server collector under the same source id with registerFlightDataSource instead of claiming the unnamed collectFlightData slot — additive, so a router's own flight data could coexist on the same mutation response. Co-authored-by: Cursor <cursoragent@cursor.com>
…rimitive; route cache redirects The collector becomes loadFlightTarget (the router's trigger) + dehydrateSettled (the cache's extraction), replacing the hand-rolled event derivation and local settled() helper. The client boot gains the last stretch of redirect glue: cache-driven fetches (background refetches, mutations) run outside the router, so redirect() errors from both caches now hand off to router.navigate — loader-driven redirects were already the router's own on both sides. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 29, 2026
brenelz
reviewed
Aug 29, 2026
| // A fresh cache and router per collection — the same pairing SSR builds | ||
| // per request in src/setup.tsx, minus the render. | ||
| const queryClient = createQueryClient(); | ||
| return loadFlightTarget({ |
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.
Draft — do not merge until three releases ship: the
@solidjs/webrelease after 2.0.0-rc.4 (multi-source single-flight protocol, solidjs/solid@653dd41e), the@tanstack/solid-queryrelease after 6.0.0-rc.1 carrying TanStack/query#11326, and the@tanstack/solid-routerrelease carrying TanStack/router#8192. A version-bump commit lands here at that point.Summary
This template is the reference for pairing TanStack Router + Query with Solid's native channels — every piece composed from public APIs along its natural boundary, no integration package.
App.tsxdrops the hand-rolled client half of single-flight (subscribeFlightData+hydrate):QueryClientProvidernow subscribes the query cache's consumer internally underFLIGHT_DATA_SOURCE("sq").server-config.tsregisters the collector additively underFLIGHT_DATA_SOURCE— so another cache's flight data could coexist on the same mutation response — and the collector itself is now a two-primitive composition:loadFlightTarget(the router's trigger: derive the flight request for the post-mutation URL, run the matched routes' data functions) +dehydrateSettled(the cache's extraction: wait out the loaders' fire-and-forget prefetches, then dehydrate). The localsettled()helper is gone.App.tsxgains the last stretch of redirect glue: cache-driven fetches (background refetches, mutations) run outside the router, so aqueryFn/mutationFnthrowingredirect()would settle into cache error state with nobody navigating. The client boot now hands redirect errors from both caches torouter.navigate— a dozen lines composingisRedirect/resolveRedirectwith the caches'config.onError. Loader-driven redirects were already the router's own on both sides (the server answers a real 30x viasetup.tsx).Net: the template's single-flight surface shrinks to just the server-side data strategy, which is the only genuinely app-specific part — and the whole Router+Query pairing needs no
*-ssr-queryintegration package: SSR transfer is the provider's hydration registry, post-mutation transfer is the flight envelope, redirect handling is the composition above.Test plan
pnpm build, vitest suite, and the browser e2e (hydration, login/rename/logout, single-flight list refresh) against the published packages.Made with Cursor