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

All Questions

Tagged with
-1 votes
2 answers
170 views

how to get a successful auth-callback message from trpc.authCallback.useQuery()? (react query v5 2024)

I've been trying to build a chatPDF project from Josh Tried Coding - on youtube (https://www.youtube.com/watch?v=ztBJqzBU5kc&t=7558s). the problem for me starts at 2:06:00 when his useQuery() ...
Yashpreet Voladoddi's user avatar
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
1 vote
1 answer
50 views

Conditional call hook to server

I would like to have a component that show fake data and if the user choose some config it will call the server using TRPC: const { date } = useDateStore(); const [config, setConfig] = useState<...
Max0u's user avatar
  • 720
0 votes
1 answer
1k views

Passing a react-query trpc query as a hook parameter

I'd like to make a generic hook that takes useQuery as a parameter and handles pagination. That means my trpc query will always provide a skip and a take parameter. And it will always return a count ...
maxime's user avatar
  • 2,255
6 votes
3 answers
20k views

How to update data that React Query has already fetched so that I do not have to refetch all the data?

Currently, my code looks like this. When mutation is successful, I have to refetch all the data because tasks will not be updated. How can I update the client-side tasks when I submit or delete a task?...
circular_reference's user avatar
0 votes
1 answer
782 views

Invalidating data with trpc.useContext() causing a infinite loop

I have am having a problem invalidating my data causing it to run nonstop in a loop and cannot see the reason why it is happening or what I need to do to fix it as I am still new with trpc. Here is my ...
Mossy82's user avatar
  • 345
0 votes
1 answer
3k views

Optimistic update mutation with tRPC, React-query causing flashing updates

I'm currently implementing optimistic updates with the tRPC useMutation React-Query hook and it appears to be functioning properly. However, I'm encountering an issue where, upon updating the data, ...
John John's user avatar
  • 1,415
0 votes
1 answer
274 views

How to narrow down the type usequery data with suspense and react-error-boundary?

I am using react query the data received after usequery contains undefined. I want to remove undefined from this data. usingQuery enter image description here root.tsx enter image description here ...
윤지만jimmy.im's user avatar
0 votes
1 answer
627 views

tRPC setData hook doesn't have access to all data for optimistic ui updates

I'm building out mutations with tRPC and React Query that optimistically update my UI when a new item is added, but I'm running into a problem. The query that I'm updating expects a certain number of ...
Jesse Winton's user avatar
3 votes
2 answers
10k views

How do I invalidate queries and fetch latest data in TRPC?

I am simply trying to get latest data from the server after performing a mutation. My code looks something like this: const utils = trpc.useContext() const markAsUnreadMutation = trpc.useMutation([...
Arpit's user avatar
  • 529
3 votes
2 answers
2k views

tRPC throws an error in setData (useContext wrapper of TanStack Query) after I updated it from v10-rc to v10

Before: ├── @tanstack/[email protected] ├── @trpc/[email protected] ├── @trpc/[email protected] ├── @trpc/[email protected] ├── @trpc/[email protected] After: ├── @tanstack/react-...
circular_reference's user avatar
4 votes
2 answers
6k views

Optimistic Updates with React-Query (TRPC)

I am not sure how I would do optimistic updates with trpc? Is this "built-in" or do I have to use react-query's useQuery hook? So far, I am trying it like so, but it's not working: const ...
antonwilhelm's user avatar
  • 7,068
0 votes
2 answers
4k views

tRPC mutateAsync returns nothing

This is my first attempt to use tRPC. I created a mutation named "add", which receive a URL as parameter and returns a hardcoded slug Router export const entryRouter = router({ add: ...
Rodrigo's user avatar
  • 235
6 votes
1 answer
3k views

react-query, react-hook-form and form validation

I'm building a form (based on react-hook-form) to filter a list of events by start and end date. The list is retrieved with react-query's useQuery() call. There's a zod-based validation in place (via @...
Tobi Kremer's user avatar
2 votes
1 answer
2k views

Filtering with React-Query + Prisma - How to pass down filters dynamically & and completely omit them from my prisma call, when they aren't present?

Say I have a filter on my frontend. I have an option to get all the users who are blue or all the users who are red. In the front-end, I pass that filter value into react-query and in the backend I ...
antonwilhelm's user avatar
  • 7,068

15 30 50 per page