You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: useInfiniteQuery causes 400 Bad Request after .invalidate() due to auto-injected cursor: undefined #6862
Using trpc.studio.getMany.useSuspenseInfiniteQuery({ limit: 5 }) works correctly on first render, but after a mutation followed by utils.studio.getMany.invalidate(), tRPC triggers a refetch that causes a 400 Bad Request error.
🔍 Logs
GET /api/trpc/studio.getMany?batch=1&input=%7B%220%22%3A%7B%22limit%22%3A5%2C%22direction%22%3A%22forward%22%7D%7D 400
Then click on the Create button →
✅ I see: POST /api/trpc/video.create?batch=1
But immediately after:
❌ I get an error: GET /api/trpc/studio.getMany?batch=1&input=%7B%220%22%3A%7B%22limit%22%3A5%2C%22direction%22%3A%22forward%22%7D%7D → 400 Bad Request
Additional information
No response
👨👧👦 Contributing
🙋♂️ Yes, I'd be down to file a PR fixing this bug!
Activity
fix(react-query): restore cursor injection with null coalescing in ge…
fix(react-query): handle undefined cursor in infinite queries with nu…
fix(react-query): always inject cursor field in infinite queries
fix(react-query): restore cursor injection with null coalescing in ge…
fix(react-query): handle undefined cursor in infinite queries with nu…
docs(react-query): clarify getClientArgs JSDoc to describe null defau…
test(react-query): strengthen trpc#6862 regression tests with strict …
fix(react-query): use !== undefined check for cursor injection in inf…
fix(react-query): always inject cursor field in infinite queries (trp…
KATT commentedon Nov 2, 2026
🤖 In v12,
infiniteOptions()takesinputas a function of the page param, e.g.input: (cursor) => ({ ...yourInput, cursor }), so the cursor only goes where you put it and nothing injectscursor: undefinedon a refetch afterinvalidate(). https://v12.trpc.io/v12/docs/integrations/tanstack-query#the-helpers. v12 isn't released yet and there's no ETA.