Repository navigation
feat(query-core, react-query): add experimental query handles, with experimental_getQueryHandleData - #6
Merged
cursor[bot] merged 3 commits intoNov 6, 2026
Conversation
…dles experimental_queryHandleAsync and experimental_ensureQueryHandle now return a type-branded experimental_DefinedQueryHandle. experimental_getQueryHandleData takes only those and reads the query's data from the cache, without fetching, waiting or creating a query, so a loader can throw notFound(). Co-authored-by: alexander <alexander@n1s.se>
🚀 Changeset Version Preview2 package(s) bumped directly, 22 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
cursor
Bot
changed the base branch from
main
to
cursor/experimental-query-handles-271e
November 6, 2026 10:16
…cast Give QueryFactoryOptions a select field so the factory's options keep their type, and drop the throw for a missing cache entry, which can't happen right after awaiting a handle. Co-authored-by: alexander <alexander@n1s.se>
Co-authored-by: alexander <alexander@n1s.se>
cursor
Bot
merged commit Nov 6, 2026
91bd116
into
cursor/experimental-query-handles-271e
4 of 5 checks passed
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.
Important
This adds one function on top of TanStack#12512, to show how a loader could read an awaited handle's data. Please discuss in TanStack#12512, not here.
🎯 Only difference from TanStack#12512
TanStack#12512 gives a loader a handle, but no way to read its data. To throw
notFound(), a loader must callqueryClient.getQueryData()with the factory's key. This PR addsexperimental_getQueryHandleData(queryClient, factory, handle), which reads it from the handle.experimental_queryHandleexperimental_QueryHandleexperimental_QueryHandleexperimental_queryHandleAsyncexperimental_QueryHandleexperimental_DefinedQueryHandleexperimental_ensureQueryHandleexperimental_QueryHandleexperimental_DefinedQueryHandleBefore (TanStack#12512)
After
experimental_DefinedQueryHandle. Passing a handle fromexperimental_queryHandleorexperimental_waterfallHandleis a type error, because its query may not have data yet{ queryKey, input }, and a defined handle works everywhere a plain one doesTDatalikeexperimental_fromHandle: what the factory'sselectreturns, or else thequeryFn's datagetQueryData, it is a plain read from the cachequeryKeyHashFn✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request. (Ran oxlint, knip,test:typesacross all TS versions, and vitest for query-core and react-query, plus the docs link check.)🚀 Release Impact