Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
1d335f6 to
1e90ebd
Compare
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
1e90ebd to
c4c65da
Compare
c4c65da to
b70b3f2
Compare
8587340 to
60bae33
Compare
|
@coderabbitai review Rebased onto #7817, which now holds the docs, demos and tab links. This PR is the blog post only. |
Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
β¦a loading state Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
β¦er than the post Co-authored-by: alexander <[email protected]>
β¦oader option Co-authored-by: alexander <[email protected]>
β¦article Co-authored-by: alexander <[email protected]>
|
@coderabbitai review |
Action performed
|
- Samples import loadHandles, the entries and fromHandle from @trpc/tanstack-react-query/unstable-handles. - "Wait, or don't" mixes entries in one load, shows the typed `data`, and how a failed entry rejects with a TRPCEntryError. - The waterfalls demo moves to "Keep it waterfall-free". "No loader?" loads handles in an event handler, not during render. - "Why unstable_$?" becomes "Why functions" and "Why unstable-". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Why
loadHandlesin #7957) need an announcement post.main. The docs it links to, #7817 and #7842, and the demos it uses, #7851, have merged.What
www/blog/query-handles.md(slugquery-handles), in the new website's blog format. It explains the problem before the API:Commentscan't start untilPostPagehas its post, and a timeline of the waterfall.limit: 20versuslimit: 10, a forgottenlocale) brings the request back without a word.loader(id)that loads a handle withloadHandlesand aprefetchEntry, and a component that reads it withfromHandle(trpc, handle), all from@trpc/tanstack-react-query/unstable-handles. Then how handles work,prefetchEntry/ensureEntry/fetchEntry, mixing them in one load (order doesn't matter, anddatahas only the waited-for entries), failed entries as aTRPCEntryError, keeping pages waterfall-free, and, for apps without loaders, loading handles in an event handler withuseTRPC(), not during render.HydrateClient), TanStack Start, and React Router (dehydrateandHydrationBoundaryin server loaders), as tabs. The tabs use the site's tab groups (<div class="code-tabs" data-tabs="framework">), so the reader's choice is saved inlocalStorageand applies to any later page with aframeworkgroup. The tabs are links, and the URL keeps the choice, from #7817.trpc, why the import path saysunstable-, and where to go next.twoslash includeblocks, so the setup can't be shared as it is in the docs. Query results are named (postQuery,commentsQuery) and read through.data, and loader data throughloaderData.post.routeTree.gen.tsregistering the router as the generator writes it, and React Router's+typesfromreact-router/internal. HoveringloaderDatashows the handle types.infiniteQueryOptionswas missing itsgetNextPageParam. It now passes it, as the fetch-on-render sample above it does.discussionfrontmatter. Since #7791, that also means no comments section.getNextPageParam, as the guides in #7817 do, andgetQueryDatais shown taking the options'queryKey. The render-as-you-fetch fragment reads its query inside a component, and the TanStack Start tab's router sets upsetupRouterSsrQueryIntegration.{ queryKey, input }and the data stays in the cache. "Wait, or don't" says a component that reads a waited-for handle renders the data at once, but still needs a loading state, since the cache can lose the data. AprefetchEntryreader shows aSuspensefallback oruseQuery'spendingstatus. The sample that readpost.data.titlefrom a handle and the paragraph on a handle's data reaching the browser twice are gone.Demos
Five demos, all from
www/src/demos/in #7817, placed withdemocode fences. Each fence's body is the static stand-in readers see before the demo loads and without JavaScript./posts/1, so the first view already shows the waterfall: the post, its comments and "More by {author}", which starts from the URL with the post. "β All posts" leads to the list, which is one query. The post's intros for both demos match.prefetchEntry,ensureEntryandfetchEntryin a browser loader, and the same blog with no loader, running the real handles API against a tRPC router in the page, with a network panel.Claude as co-author
https://github.com/claude.png), the one shown on Claude-co-authored commits. It loads the same way as KATT's, so the post page, the blog index card and the social card show it with no changes outside the post.Links
trpc? and Whyunstable-?/blog/og/blog/query-handles.pngScreenshots
Alternatives considered
<details>) per framework instead of tabs: they work, but each reader opens one and scrolls past the other two closed boxes, and the choice isn't remembered. The site's tab groups already remember the package manager the same way.Testing
pnpm --filter www check-twoslashon the post: all 12 blocks pass, and notsortsxblock is left without Twoslash. A temporaryconst probe: number = loaderDatain both route samples failed with the real loader data type, so neither isany.loaderDatain the TanStack Start and React Router tabs shows the handle types.pnpm typecheck-www,pnpm --filter www lint,pnpm --filter www test(511 tests) andpnpm --filter www build(all 707 trpc.io URLs resolve) pass./blog./og/blog/query-handles.pngrenders both authors with their avatars (both from GitHub), and the description fits on two lines.trpc-docs:tab:framework), and it's still selected after a reload.?framework=react-routeropens on React Router with nothing stored; clicking each tab switches it, sets?framework=β¦without a new history entry, and moves the page by 0px; a reload keeps it; the URL wins over the stored choice and the stored choice applies without it; a modifier-click opens?framework=react-routerin a new page on that tab and leaves the current one alone; following a link to/blogdrops the param; the quickstart's package-manager tabs are still buttons and leave the URL alone.?flags=demo#in-your-framework: hovering the TanStack Start tab sets its href to?flags=demo&framework=tanstack-start#in-your-framework, and Ctrl-click opens that URL in a new page and leaves the current one alone. Space on the focused React Router tab selects it and setsframework=react-routerwithout scrolling the page.mainis the post alone.Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
unstable_$naming.