Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
36 views

⨯ TypeError: react__WEBPACK_IMPORTED_MODULE_2__.useContext is not a function

I am working on a Next.js project where I am using TRPC and React Query for data fetching. However, I am encountering a TypeError: useContext is not a function error. Here is my setup: TRPC Client ...
Deepansh .i's user avatar
0 votes
2 answers
91 views

Conditional tRPC v10 fetch with useQuery and required parameters

I'm trying to understand how to use the @tanstack/react-query integration for tRPC when I have conditional fetches that have required parameters. For example, say I have this backend: // Backend ...
Alex Wayne's user avatar
  • 185k
0 votes
1 answer
96 views

Is onSuccess Callback is removed from query (tRPC)?

app/auth-callback/page.tsx import { useRouter, useSearchParams } from 'next/navigation' import React from 'react' import { trpc } from '../_trpc/client' const Page = () => { const router = ...
Kartik Malik's user avatar
0 votes
0 answers
331 views

How can I refetch a query conditionally with TRPC + react query?

In my next js 14 App I am using TRPC + react query to fetch data from my server. I have a component that shows the count of notifications: export function BadgedUserAvatar(): JSX.Element { //Fetch ...
Ignacio García's user avatar
0 votes
0 answers
47 views

tanstack react-query ENOENT error when uninstalling v5 and installing v4

FULL ERROR: ./node_modules/@tanstack/react-query/build/modern/index.js Error: ENOENT: no such file or directory, open 'C:\Users\riodj\infoscan\node_modules@tanstack\react-query\build\modern\index.js' ...
Rio's user avatar
  • 31
0 votes
1 answer
341 views

Access Cookies in TRPC fetch handler

I am building Token Based Authentication in my TRPC Nextjs application. I am storing the refresh token in the users cookies. In case a request fails because the access token is expired, i want to ...
KlautNet's user avatar
2 votes
2 answers
1k views

onSuccess and onError are not working in newest version of React-Query?

Errors show up in onSuccess and onError functions. Did some research and turns out these functions are depcrecated in newest version of React-Query. "use client" import { useRouter, ...
Rio's user avatar
  • 31
0 votes
2 answers
336 views

Issue with onSuccess callback in Next.js useQuery hook from trpc.authCallback

I'm encountering an error while attempting to use the onSuccess callback with the useQuery hook from trpc.authCallback in a Next.js application. Despite explicitly defining the type for the success ...
youssef-lou's user avatar
0 votes
1 answer
94 views

trpc .fetch in nextjs app router, does fetch() get deduped?

Will a .fetch() call on a initTRPC.context, server side, be deduped by the nextjs app router or not? From nextjs docs: "Passing data between a parent layout and its children is not possible. ...
Sindre's user avatar
  • 130
1 vote
1 answer
75 views

Unable to Retrieve Data from useMutation Call Despite Successful Internal Fetch

I'm relatively new to tRPC so please bear with me on this. I'm encountering an issue with the useMutation query. When I call useMutation with new input, it returns undefined for data. However, I can ...
Juan's user avatar
  • 11
0 votes
1 answer
684 views

Tanstack react query useInfiniteQuery data is not updated client data, the server returns the updated data

I have a problem using react query with my trpc api. I am using an infiniteQuery, the staletime is 0, when I come on the screen the query is fetching and the server returns the updated data but in ...
Pakenfit's user avatar
  • 180
2 votes
1 answer
1k views

Invalidating an Inactive Query in tRPC within T3 Stack

I'm using the T3 Stack with tRPC and facing a challenge with query invalidation across different routes. My application has two routes: /profile and /student-profile. On /profile: I display a list ...
Richard Biroš's user avatar
0 votes
0 answers
873 views

How to use trpc and react-query within a function for useMutation()

I have a very specific problem. I have been using trpc with react-query and so far it has been amazing and this is the only big issue I've faced with it. Following the setup for trpc/react-query/next....
frost2709's user avatar
  • 341
0 votes
1 answer
365 views

backend receiving empty input object when using mutation in tRPC

When using useQuery I have no issues even with input but when using useMutation the backend is receiving an empty input. What could be the reason? stack is nodejs + express + reactjs + yarn Frontend ...
Krishna's user avatar
  • 55
0 votes
1 answer
800 views

Aborting a query using trpc react-query

Reference Canceling with React Query The standard way to abort a query using react-query is to use the AbortController to abort the fetch request (reference https://tanstack.com/query/v4/docs/react/...
basarat's user avatar
  • 273k

15 30 50 per page