Repository navigation
docs: tips that point to query handles, and real types in the App Router setup samples - #7849
Conversation
…ries early Co-authored-by: alexander <[email protected]>
… name query results Co-authored-by: alexander <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
… in the browser's cache Co-authored-by: alexander <[email protected]>
|
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
queryOptions, and a few tips point to handles where a page can start its queries early.~/trpc/serverand~/trpc/clientwith hand-writtendeclare modulestubs. The setup's router makeshellotake{ text }, but four samples called it with no input, which fails input validation at runtime. The stubs hid that.What
:::tipcallouts, each linking to Prefetching with handles:unstable_$ensureand pass the handle, or useunstable_$prefetchonuseTRPC()at the top of the page.queryOptions, it can read a handle instead.getServerSidePropssample: return a handle instead of theid, so the two inputs can't drift apart.props.twoslash includebuilt from the setup's real router, query client and server file (prefetchandHydrateClientas on the page).trpc.hello.queryOptions()andcaller.hello()now pass{ text: 'world' }.useQuerysample switches ongreetingQuery.statusinstead of checking!greeting.data, and theuseSuspenseQuerysample names its resultgreetingQueryinstead of destructuringdata.Greeting, notUsers, and rendersgreetingQuery.data.www/build/collapse.ts: the Shiki transformer is namedtrpc-docs:collapse, like the others, notraf-query-docs:collapse.Links
getServerSideProps: new tip.{ text: 'world' }where it was missing.status.greetingQuery.Greetingrenders the data.Alternatives considered
unstable_.Testing
pnpm --filter www check-twoslash: 462 blocks compile, including the App Router samples against the real router.pnpm validate-skills: all 24 skills pass, including the size limit on the generated Pages Router skill.pnpm --filter www test(314 tests),pnpm --filter www lint,pnpm typecheck-wwwandpnpm --filter www buildpass. All 698 trpc.io URLs work.callout-tipaside.props: a handle is a plain{ queryKey, input }object, and since #7848 it leaves outinputwhen it'sundefined.AI model
Claude Opus 5.5
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit