\n\n### Link to reproduction\n\n---\n\n### To reproduce\n\n---\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[2913],{"name":2894,"color":2895},6737,"bug: cannot narrow input types of `useMutation(trpc...).mutate(INPUT)` - cannot overwrite `mutationoptions.mutationFn` (`@trpc/tanstack-react-query`)","2025-05-01T18:59:50Z","https://github.com/trpc/trpc/issues/6737",0.6572762,{"description":2920,"labels":2921,"number":2922,"owner":2860,"repository":2860,"state":2905,"title":2923,"updated_at":2924,"url":2925,"score":2926},"### Describe the feature you'd like to request\n\nright now, trpc defaults to sending the `AbortSignal` produced by react-query to the query function. This makes sure requests that become unused while they are still in-flight will be aborted.\r\n\r\nThis is nice, but not the default behaviour of react-query. We default to letting the promise finish so that it will be put into the cache, and it will stay there until `cacheTime` elapses. This makes sure that if you come back to the page, you already have a result.\r\n\r\nIt's also interesting that trpc doesn't have a way to customize this, either globally or per-query.\r\n\r\nIn RQ, you'd customize this by either using the provided `signal` or by _not_ using it:\r\n\r\n```\r\n// ⬇️ this request aborts\r\nuseQuery(key, ({ signal }) => axios.get(url, { signal })\r\n\r\n// ⬇️ this request doesn't abort\r\nuseQuery(key, () => axios.get(url)\r\n```\n\n### Describe the solution you'd like to see\n\neither keep the default in sync with react-query, and/or provide a way to opt out of the behaviour. Since we don't expose the queryFn, it would need to be done in a different way.\n\n### Desribe alternate solutions\n\nthings can stay as they are, but I think letting data resolve would be the better default, and I would at least like the option to use this feature of react-query :)\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR implementing this feature!",[],2612,"feat: AbortSignal","2022-10-04T00:17:59Z","https://github.com/trpc/trpc/issues/2612",0.68046206,{"description":2928,"labels":2929,"number":2870,"owner":2860,"repository":2860,"state":2905,"title":2935,"updated_at":2936,"url":2937,"score":2875},"When [doing updates optimistically](https://react-query.tanstack.com/guides/optimistic-updates), having a `context` value to roll back failed mutations with is crucial. Unfortunately, the `TContext` type used within React Query isn’t inferred in tRPC’s React Query client, and so the value of `context` will always be `unknown`, e.g. in `onError` handlers.\r\n\r\nProviding a fourth generic type parameter, `TContext`, to the underlying `useQuery` and `useMutation` hooks might help – please see the related code snippet for details: https://github.com/trpc/trpc/blob/39129c54eb9ede1542b4cd2093d85bf371cdfa8e/packages/react/src/createReactQueryHooks.tsx#L188-L223",[2930,2933],{"name":2931,"color":2932},"👉 good first issue","7057ff",{"name":2934,"color":2884},"wontfix","Context type of queries and mutations isn’t inferred when using React Query","2022-10-05T00:09:26Z","https://github.com/trpc/trpc/issues/391",{"description":2939,"labels":2940,"number":2944,"owner":2860,"repository":2860,"state":2905,"title":2945,"updated_at":2946,"url":2947,"score":2948},"> From @KATT:\r\n>\r\n> We should `Omit` `mutationFn` etc from `UseMutationOptions` (and for queries too)\r\n>\r\n\r\n\r\n### Provide environment information\r\n\r\n```\r\n System:\r\n OS: macOS 13.6\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 123.95 MB / 16.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 18.16.1 - /usr/local/bin/node\r\n Yarn: 1.22.17 - /usr/local/bin/yarn\r\n npm: 9.5.1 - /usr/local/bin/npm\r\n pnpm: 8.6.10 - /opt/homebrew/bin/pnpm\r\n Watchman: 2022.06.27.00 - /opt/homebrew/bin/watchman\r\n Browsers:\r\n Chrome: 117.0.5938.92\r\n Safari: 16.6\r\n npmPackages:\r\n @tanstack/react-query: ^4.29.5 => 4.29.14 \r\n @trpc/client: ^10.21.1 => 10.23.0 \r\n @trpc/next: ^10.23.0 => 10.23.0 \r\n @trpc/react-query: ^10.21.1 => 10.23.0 \r\n @trpc/server: ^10.21.1 => 10.23.0 \r\n next: ^13.3.4 => 13.3.4 \r\n react: ^18.2.0 => 18.2.0 \r\n typescript: ^5.0.4 => 5.0.4 \r\n ```\r\n\r\n### Describe the bug\r\n\r\n`mutationFn` is not being called on `mutate.` My use-case is I need to add some variables from localStorage to my payload before it gets sent off in the mutation. `mutationFn` is never called, though `onSuccess` is.\r\n\r\n```\r\nexport const trpc = createTRPCNext({...})\r\n```\r\n\r\n```\r\n const mutation = trpc.auth.verifyCode.useMutation({\r\n mutationFn: async (variables) => {\r\n console.log('called'); // NEVER CALLED\r\n const extendedVariables = {\r\n ...variables,\r\n referralCode: maybeReferralCode,\r\n ...validatedUtm,\r\n };\r\n return trcpProxyClient.auth.verifyCode.mutate(extendedVariables);\r\n },\r\n\r\n onSuccess(data) {\r\n console.log('called2'); // CALLED\r\n storage.setAccessToken(data.accessToken);\r\n storage.setRefreshToken(data.refreshToken);\r\n\r\n identify(data);\r\n },\r\n });\r\n\r\n return mutation;\r\n};\r\n```\r\n\r\n### Link to reproduction\r\n\r\nhttps://stackblitz.com/edit/github-ucxmx2?file=src%2Fpages%2Findex.tsx\r\n\r\n### To reproduce\r\n\r\nSee example user mutation `updateUser`\r\n\r\nhttps://stackblitz.com/edit/github-ucxmx2?file=src%2Fpages%2Findex.tsx\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[2941],{"name":2942,"color":2943},"👻 invalid","e4e669",4860,"bug: mutationFn being ignored","2025-03-20T15:41:56Z","https://github.com/trpc/trpc/issues/4860",0.68095565,{"description":2950,"labels":2951,"number":735,"owner":2860,"repository":2952,"state":2905,"title":2953,"updated_at":2954,"url":2955,"score":2956},"- Gotta be a client-side component\r\n- Unsure if we should use `react-query` for mutation, we could or use `@trpc/client` directly",[],"next-13","Use `post.create`","2022-10-30T14:54:49Z","https://github.com/trpc/next-13/issues/2",0.6855681,["Reactive",2958],{},["Set"],["ShallowReactive",2961],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fggXSS8f9PwxpxkTMK9Tz4rntfdFYRdd-7zhfReO2X74":-1},"/trpc/trpc/4924"]