Skip to content
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

fix(react-query): get queryClient from trpc context #5718

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

tmkx
Copy link

@tmkx tmkx commented May 13, 2024

🎯 Changes

this change keeps the same as useQuery,

function useQuery(
path: string[],
input: unknown,
opts?: UseTRPCQueryOptions<unknown, unknown, TError>,
): UseTRPCQueryResult<unknown, TError> {
const context = useContext();
const { abortOnUnmount, client, ssrState, queryClient, prefetchQuery } =
context;

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@tmkx tmkx requested a review from a team as a code owner May 13, 2024 06:27
Copy link

vercel bot commented May 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2024 2:46am

Copy link

vercel bot commented May 13, 2024

@tmkx is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the rationale for this change? Did you run into a bug with the current implementation or is it just a stylistic change?

@tmkx
Copy link
Author

tmkx commented May 15, 2024

I didn't add QueryClientProvider at first (I mistakenly assumed that trpc.Provider had already done this), trpc.hello.useQuery() works fine but trpc.hello.useMutation() throws an error, it's a little confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants