fix(ui): Fix "Missing queryFn" error in useAggregatedQueryKeys#112488
Merged
fix(ui): Fix "Missing queryFn" error in useAggregatedQueryKeys#112488
Conversation
QueryObserver was created without a queryFn to listen for when fetchQuery resolved. In TanStack Query v5 this throws "Missing queryFn" whenever the observer evaluates stale data. Fires on every batch of IDs buffered through useReplayCount so it spams on any issue list page. Replace the observer with .finally() on the fetchQuery promise to clean up inFlight markers — simpler and doesn't need the subscription ref cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TkDodo
approved these changes
Apr 8, 2026
Collaborator
TkDodo
left a comment
There was a problem hiding this comment.
creating an observer without a queryFn is like calling useQuery without a queryFn. This was never a supported pattern - TS allows it because you can have a defaultQueryFn and only then is it okay to omit it. One of the things we’ll fix in v6
Collaborator
|
The observer was added here: so maybe best to wait for @ryan953 before merging |
ryan953
approved these changes
Apr 8, 2026
Member
ryan953
left a comment
There was a problem hiding this comment.
seems fine. it's been so long ago i don't have any extra info that y'all don't also have.
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
`useAggregatedQueryKeys` created a `QueryObserver` without a `queryFn` just to listen for when `fetchQuery` resolved so it could clean up inFlight markers. In TanStack Query v5 this throws "Missing queryFn" Replace the observer with `.finally()` on the promise `fetchQuery` already returns - simpler and doesn't need the subscription ref cleanup. fixes JAVASCRIPT-38K4 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
useAggregatedQueryKeyscreated aQueryObserverwithout aqueryFnjust to listen for whenfetchQueryresolved so it could clean up inFlight markers. In TanStack Query v5 this throws "Missing queryFn"Replace the observer with
.finally()on the promisefetchQueryalready returns - simpler and doesn't need the subscription ref cleanup.fixes JAVASCRIPT-38K4