Add QueryObserver state utility methods to QueryCollectionUtils#742
Merged
KyleAMathews merged 7 commits intomainfrom Nov 5, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: 50c5d1a The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
Contributor
|
Size Change: 0 B Total Size: 79.1 kB ℹ️ View Unchanged
|
Contributor
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
4 tasks
2f89188 to
ca3361d
Compare
…tters
Adds new utilities to expose TanStack Query's QueryObserver state:
- isFetching: Check if query is currently fetching
- isRefetching: Check if query is refetching in background
- isLoading: Check if query is loading for first time
- dataUpdatedAt: Timestamp of last successful data update
- fetchStatus: Current fetch status ('fetching' | 'paused' | 'idle')
BREAKING CHANGE: Error state utilities are now getters instead of methods:
- collection.utils.lastError() → collection.utils.lastError
- collection.utils.isError() → collection.utils.isError
- collection.utils.errorCount() → collection.utils.errorCount
ca3361d to
f8fd37f
Compare
samwillis
requested changes
Nov 5, 2025
Collaborator
samwillis
left a comment
There was a problem hiding this comment.
Looking very good, much prefer this to the previous and the widening of the types for the utils.
Just a comment above on the class being a closure.
Addresses PR feedback from samwillis: refactor QueryCollectionUtilsImpl class to be extracted outside the function scope with required state passed through the constructor instead of relying on closure patterns. This improves code architecture by making dependencies explicit and avoiding nested class definitions within functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Re-generate documentation after QueryCollectionUtilsImpl refactoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Regenerated all documentation files after running full build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
samwillis
approved these changes
Nov 5, 2025
| } | ||
|
|
||
| /** | ||
| * Implementation class for QueryCollectionUtils that maintains proper closure |
Collaborator
There was a problem hiding this comment.
that maintains proper closure
its not a colure any more...
Update QueryCollectionUtilsImpl class comment to accurately reflect that it now uses explicit dependency injection instead of closure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Merged
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.
Adds new utility methods to QueryCollectionUtils to expose TanStack Query's QueryObserver state, addressing user request for visibility into sync status:
New utils exposed:
This allows users to:
Converted error state utilities from methods to getters:
Resolves user request from Discord where status is always 'ready' after initial load, making it impossible to know if background refetches are happening.