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
Add QueryObserver state utility methods to QueryCollectionUtils (#742)
* feat: Add QueryObserver state utilities and convert error utils to getters
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
* refactor: Extract QueryCollectionUtilsImpl class from 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>
* chore: Update generated docs
Re-generate documentation after QueryCollectionUtilsImpl refactoring.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: Re-generate documentation after build
Regenerated all documentation files after running full build.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: Fix outdated comment about closure usage
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>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Add QueryObserver state utilities and convert error utils to getters
7
+
8
+
Exposes TanStack Query's QueryObserver state through QueryCollectionUtils, providing visibility into sync status beyond just error states. Also converts existing error state utilities from methods to getters for consistency with TanStack DB/Query patterns.
9
+
10
+
**Breaking Changes:**
11
+
12
+
-`lastError()`, `isError()`, and `errorCount()` are now getters instead of methods
13
+
- Before: `collection.utils.lastError()`
14
+
- After: `collection.utils.lastError`
15
+
16
+
**New Utilities:**
17
+
18
+
-`isFetching` - Check if query is currently fetching (initial or background)
19
+
-`isRefetching` - Check if query is refetching in background
20
+
-`isLoading` - Check if query is loading for first time
21
+
-`dataUpdatedAt` - Get timestamp of last successful data update
22
+
-`fetchStatus` - Get current fetch status ('fetching' | 'paused' | 'idle')
23
+
24
+
**Use Cases:**
25
+
26
+
- Show loading indicators during background refetches
27
+
- Implement "Last updated X minutes ago" UI patterns
0 commit comments