TanStack / TanStack/query

solid-query v6: useQueries doesn't attach to the new hydration channel from #11168

Open
#11,185 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
50.3k
Forks
4.2k
Avg merge
18h 25m
Merged PRs (30d)
200

Description

#11168 (merged today on solid-query-v6-pre, targeting @tanstack/solid-query@6.0.0-beta.x) adds a provider-owned hydration channel so QueryClientProvider primes the cache from the server-dehydrated stream and useBaseQuery waits for its own entry to be primed (whenQueryPrimed) before attaching its observer, instead of doing a mount refetch on data that's about to arrive.

useQueries doesn't go through any of that. I read the current packages/solid-query/src/useQueries.ts on solid-query-v6-pre: it builds its own QueriesObserver directly —

const observer = untrack(
  () => new QueriesObserver<TCombinedResult>(client(), defaultedQueries(), ...),
)
...
createEffect(() => {
  if (!isRestoring()) {
    unsubscribe = observer.subscribe((result) => { ... })
  }
})

— with no reference to hydrationChannel, whenQueryPrimed, or the executorRan replay-detection flag useBaseQuery added (confirmed with rg "whenQueryPrimed|executorRan|hydrat" over the file: zero matches). The observer is constructed and its optimistic result read synchronously on mount, so if this runs before the provider's channel has applied hydrate() for these query keys, useQueries sees a cold cache and behaves exactly like the pre-#11168 useBaseQuery did: no priming coordination, so a query whose data is already in flight from the SSR stream can still trigger a mount refetch even though it's well within staleTime.

This isn't a guess — the PR body says so explicitly under "Coexistence with TanStack Start": "useQueries does not go through this path (it did not serialize hydration data before either); with the channel in place its queries would be primed too as soon as they settle on the server — client attach for it could be covered in a follow-up."

Since this is still pre-release (solid-query-v6-pre, not yet on main), flagging it now while the hydration channel work is fresh in mind seems more useful than after the branch merges and beta ships. Happy to help verify a fix against the same hydration.test.tsx SSR/hydration fixture #11168 added if that's useful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/solid-query/src/useQueries.ts and the hydration-channel changes from #11168, comparing useQueries with the priming path described for useBaseQuery. Run the hydration.test.tsx SSR/hydration fixture; done means useQueries coordinates with the provider-owned channel without triggering a mount refetch while streamed data is being primed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.