Repository navigation
docs(tanstack-react-query): handles work with useQuery too, and every reader needs a loading state - #7842
Conversation
… reader needs a loading state Co-authored-by: alexander <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 7 Skipped Deployments
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Initial reader loading states www/v11/docs/client/tanstack-react-query/handles.md, www/v11/docs/client/tanstack-react-query/usage.md |
The docs distinguish prefetch loading from the cached first render after ensure or fetch. They describe useSuspenseQuery fallbacks and useQuery pending states. |
Reader states and cache loss www/v11/docs/client/tanstack-react-query/handles.md |
The docs describe useQuery pending, error, and success states. They cover data removal, reset, garbage collection, and background refetch after invalidation. |
In-render and framework guidance www/v11/docs/client/tanstack-react-query/handles.md, www/v11/docs/client/tanstack-react-query/tanstack-start.md |
The docs describe reader choices during rendering and explain that readers can suspend if cached data is later lost, including in Next.js and TanStack Start examples. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Possibly related PRs
- trpc/trpc#7817: Introduced the query-handle documentation in the same pages.
- trpc/trpc#7822: Changed handle data behavior and reader fetching after cache loss.
- trpc/trpc#7838: Documents the choice between
useQueryanduseSuspenseQueryfor unawaited work.
Suggested reviewers: trpc-bot
Merge Risk: 
Minimal · up to e6111
-
Merge Risk: ⚪ Minimal · up to
e6111The loading-state guidance has no identified issue requiring a fix before merge.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
CodeRabbit Verify
- Run CodeRabbit Verify to test the changes in this pull request.
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
…data and options Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
trpc-bot
left a comment
There was a problem hiding this comment.
CI is green and all CodeRabbit threads are resolved.
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
useSuspenseQueryand aSuspenseboundary to read a handle. You don't:useQueryworks with every method.unstable_$ensureneeds noSuspenseboundary. It renders at once, but the cache can lose the data later, and then the reader loads it again.What
handles.md:useQuerysection, with a sample that switches onpostQuery.status.resetQueries,removeQueriesandclear(),gcTime, andinvalidateQueries, and says to give every reader a loading state.unstable_$prefetchandunstable_$ensurebullets, the "Which to use" table, the in-render notes and the Next.jsunstable_$ensurenotes no longer say aSuspenseboundary is needed or not needed.usage.mdandtanstack-start.md: the same fix in their short handle notes.I checked each claim against TanStack Query 5 with a scratch test, reading a handle from
unstable_$ensure:useQueryuseSuspenseQueryresetQueries()pending, no data, refetchremoveQueries(),clear()pendinginvalidateQueries()Links
useQueryunstable_$prefetchOpen in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
useQuery’s pending status.