Skip to content

fix(ui): Fix "Missing queryFn" error in useAggregatedQueryKeys#112488

Merged
scttcper merged 1 commit intomasterfrom
scttcper/fix-missing-queryfn
Apr 8, 2026
Merged

fix(ui): Fix "Missing queryFn" error in useAggregatedQueryKeys#112488
scttcper merged 1 commit intomasterfrom
scttcper/fix-missing-queryfn

Conversation

@scttcper
Copy link
Copy Markdown
Member

@scttcper scttcper commented Apr 8, 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

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>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 8, 2026
@scttcper scttcper marked this pull request as ready for review April 8, 2026 17:39
@scttcper scttcper requested a review from a team as a code owner April 8, 2026 17:39
@scttcper scttcper requested review from TkDodo and ryan953 April 8, 2026 17:39
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@TkDodo
Copy link
Copy Markdown
Collaborator

TkDodo commented Apr 8, 2026

The observer was added here:

so maybe best to wait for @ryan953 before merging

Copy link
Copy Markdown
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine. it's been so long ago i don't have any extra info that y'all don't also have.

@scttcper scttcper merged commit c97b218 into master Apr 8, 2026
67 checks passed
@scttcper scttcper deleted the scttcper/fix-missing-queryfn branch April 8, 2026 18:00
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants