-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react-query): added initialData
overloads for useQuery
#3500
feat(react-query): added initialData
overloads for useQuery
#3500
Conversation
@JoshuaKGoldberg is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/react-query/src/shared/hooks/deprecated/createHooksInternal.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Alex / KATT <alexander@n1s.se>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love @juliusmarminge to look at this cause he raised the original issue π
Co-authored-by: Alex / KATT <alexander@n1s.se>
cc @juliusmarminge smash the merge button if you like it |
Will look in a bit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
I added back the original regression tests that verifies that "all ways" return the same as tanstack (destructuring, initialData, fallbackData).
initialData
overloads for useQuery
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@trpc/client](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.7.0` -> `10.8.1`](https://renovatebot.com/diffs/npm/@trpc%2fclient/10.7.0/10.8.1) | [![age](https://badges.renovateapi.com/packages/npm/@trpc%2fclient/10.8.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@trpc%2fclient/10.8.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@trpc%2fclient/10.8.1/compatibility-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@trpc%2fclient/10.8.1/confidence-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/next](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.7.0` -> `10.8.1`](https://renovatebot.com/diffs/npm/@trpc%2fnext/10.7.0/10.8.1) | [![age](https://badges.renovateapi.com/packages/npm/@trpc%2fnext/10.8.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@trpc%2fnext/10.8.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@trpc%2fnext/10.8.1/compatibility-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@trpc%2fnext/10.8.1/confidence-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/react-query](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.7.0` -> `10.8.1`](https://renovatebot.com/diffs/npm/@trpc%2freact-query/10.7.0/10.8.1) | [![age](https://badges.renovateapi.com/packages/npm/@trpc%2freact-query/10.8.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@trpc%2freact-query/10.8.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@trpc%2freact-query/10.8.1/compatibility-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@trpc%2freact-query/10.8.1/confidence-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/server](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.7.0` -> `10.8.1`](https://renovatebot.com/diffs/npm/@trpc%2fserver/10.7.0/10.8.1) | [![age](https://badges.renovateapi.com/packages/npm/@trpc%2fserver/10.8.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@trpc%2fserver/10.8.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@trpc%2fserver/10.8.1/compatibility-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@trpc%2fserver/10.8.1/confidence-slim/10.7.0)](https://docs.renovatebot.com/merge-confidence/) | | [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | [`1.10.15` -> `1.10.16`](https://renovatebot.com/diffs/npm/libphonenumber-js/1.10.15/1.10.16) | [![age](https://badges.renovateapi.com/packages/npm/libphonenumber-js/1.10.16/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/libphonenumber-js/1.10.16/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/libphonenumber-js/1.10.16/compatibility-slim/1.10.15)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/libphonenumber-js/1.10.16/confidence-slim/1.10.15)](https://docs.renovatebot.com/merge-confidence/) | | [quicktype-core](https://togithub.com/quicktype/quicktype) | [`7.0.2` -> `7.0.3`](https://renovatebot.com/diffs/npm/quicktype-core/7.0.2/7.0.3) | [![age](https://badges.renovateapi.com/packages/npm/quicktype-core/7.0.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/quicktype-core/7.0.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/quicktype-core/7.0.3/compatibility-slim/7.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/quicktype-core/7.0.3/confidence-slim/7.0.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>trpc/trpc</summary> ### [`v10.8.1`](https://togithub.com/trpc/trpc/releases/tag/v10.8.1) [Compare Source](https://togithub.com/trpc/trpc/compare/v10.8.0...v10.8.1) ##### What's Changed - chore: bump `peerDependencies` between `@trpc/*`-packages by [@​KATT](https://togithub.com/KATT) **Full Changelog**: trpc/trpc@v10.8.0...v10.8.1 ### [`v10.8.0`](https://togithub.com/trpc/trpc/releases/tag/v10.8.0) [Compare Source](https://togithub.com/trpc/trpc/compare/v10.7.0...v10.8.0) ##### What's Changed - feat(client): add base client for integrations by [@​bautistaaa](https://togithub.com/bautistaaa) & [@​KATT](https://togithub.com/KATT) in [trpc/trpc#3389, [trpc/trpc#3479 - chore: deprecate usage of `createHooksInternal` by [@​KATT](https://togithub.com/KATT) in [trpc/trpc#3480 - chore: pruned some never-used code by [@​JoshuaKGoldberg](https://togithub.com/JoshuaKGoldberg) in [trpc/trpc#3487 - fix(react-query): fix import from dist folder by [@​gspetrou](https://togithub.com/gspetrou) in [trpc/trpc#3499 - feat: accept function param in `initTRPC.context` by [@​juliusmarminge](https://togithub.com/juliusmarminge) in [trpc/trpc#3495 - feat: handle reserved properties key collisions by [@​sachinraja](https://togithub.com/sachinraja) in [trpc/trpc#3466 - feat(react-query): added `initialData` overloads for `useQuery` by [@​JoshuaKGoldberg](https://togithub.com/JoshuaKGoldberg) in [trpc/trpc#3500 - feat: add `resHeaders` to fetch-adapter's `createContext` by [@​sachinraja](https://togithub.com/sachinraja) in [trpc/trpc#3532 - Add cloudflare-page-plugin-trpc into the Awesome tRPC collection list by [@​toyamarinyon](https://togithub.com/toyamarinyon) in [trpc/trpc#3531 - fix(client): use constant of websocket impl by [@​nohum](https://togithub.com/nohum) in [trpc/trpc#3542 - chore(client): rm redundant `getLinks()` from client factory by [@​KATT](https://togithub.com/KATT) in [trpc/trpc#3541 ##### New Contributors - [@​JoshuaKGoldberg](https://togithub.com/JoshuaKGoldberg) made their first contribution in [trpc/trpc#3482 - [@​mishankov](https://togithub.com/mishankov) made their first contribution in [trpc/trpc#3492 - [@​guushamann](https://togithub.com/guushamann) made their first contribution in [trpc/trpc#3493 - [@​gspetrou](https://togithub.com/gspetrou) made their first contribution in [trpc/trpc#3499 - [@​zihan-ch](https://togithub.com/zihan-ch) made their first contribution in [trpc/trpc#3511 - [@​roj1512](https://togithub.com/roj1512) made their first contribution in [trpc/trpc#3515 - [@​nfabredev](https://togithub.com/nfabredev) made their first contribution in [trpc/trpc#3457 - [@​hrstmr](https://togithub.com/hrstmr) made their first contribution in [trpc/trpc#3519 **Full Changelog**: trpc/trpc@v10.7.0...v10.8.0 </details> <details> <summary>catamphetamine/libphonenumber-js</summary> ### [`v1.10.16`](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.10.15...v1.10.16) [Compare Source](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.10.15...v1.10.16) </details> <details> <summary>quicktype/quicktype</summary> ### [`v7.0.3`](https://togithub.com/quicktype/quicktype/compare/5dbf11c85037e3f6a1ae842cf124c14546827a43...90a6bc16e854c337955ea453fe36a6d7fcd17c99) [Compare Source](https://togithub.com/quicktype/quicktype/compare/5dbf11c85037e3f6a1ae842cf124c14546827a43...90a6bc16e854c337955ea453fe36a6d7fcd17c99) </details> --- ### Configuration π **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π» **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/weareinreach/InReach). PR-URL: #141 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Closes #2996
π― Changes
adds function overloads to two forms of
useQuery
:trpc.useQuery
: with an inline function overloadctx.proxy.post.byId.useQuery
& the like: with an interface containing multiple call signaturesBoth overloads indicate that if
opts.initialData
is defined, the result should have a defineddata
.β Checklist