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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@tanstack/[email protected]
Minor Changes
Add QueryObserver state utilities and convert error utils to getters (#742)
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.
Breaking Changes:
lastError(),isError(), anderrorCount()are now getters instead of methodscollection.utils.lastError()collection.utils.lastErrorNew Utilities:
isFetching- Check if query is currently fetching (initial or background)isRefetching- Check if query is refetching in backgroundisLoading- Check if query is loading for first timedataUpdatedAt- Get timestamp of last successful data updatefetchStatus- Get current fetch status ('fetching' | 'paused' | 'idle')Use Cases:
Example Usage:
Patch Changes
Fix dependency bundling issues by moving @tanstack/db to peerDependencies (#766)
What Changed:
Moved
@tanstack/dbfrom regular dependencies to peerDependencies in:@tanstack/offline-transactions@tanstack/query-db-collectionRemoved
@opentelemetry/apidependency from@tanstack/offline-transactions.Why:
These extension packages incorrectly declared
@tanstack/dbas both a regular dependency AND a peerDependency simultaneously. This caused lock files to develop conflicting versions, resulting in multiple instances of@tanstack/dbbeing installed in consuming applications.The fix removes
@tanstack/dbfrom regular dependencies and keeps it only as a peerDependency. This ensures only one version of@tanstack/dbis installed in the dependency tree, preventing version conflicts.For local development,
@tanstack/dbremains in devDependencies so the packages can be built and tested independently.Updated dependencies [
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
Fix type inference for findOne() when used with join operations (#749)
Previously, using
findOne()with join operations (leftJoin, innerJoin, etc.) resulted in the query type being inferred asnever, breaking TypeScript type checking:The Fix:
Fixed the
MergeContextWithJoinTypetype definition to conditionally include thesingleResultproperty only when it's explicitlytrue, avoiding type conflicts whenfindOne()is called after joins:Why This Works:
By using a conditional intersection that omits the property entirely when not needed, we avoid type conflicts. Intersecting
{} & { singleResult: true }cleanly results in{ singleResult: true }, whereas the previous approach created conflicting property types resulting innever. The tuple wrapper ([TFlag]) ensures robust behavior even if the flag type becomes a union in the future.Impact:
findOne()now works correctly with all join typesuseLiveQueryand other contextsfindOne()before and after joins work correctlyImprove error messages for custom getKey with joined queries (#717)
Enhanced
DuplicateKeySyncErrorto provide context-aware guidance when duplicate keys occur with customgetKeyand joined queries.The Issue:
When using custom
getKeywith joins, duplicate keys can occur if the join produces multiple rows with the same key value. This is valid for 1:1 relationships but problematic for 1:many relationships, and the previous error message didn't explain what went wrong or how to fix it.What's New:
When a duplicate key error occurs in a live query collection that uses both custom
getKeyand joins, the error message now:getKeyfunctionExample:
Add QueryObserver state utilities and convert error utils to getters (#742)
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.
Breaking Changes:
lastError(),isError(), anderrorCount()are now getters instead of methodscollection.utils.lastError()collection.utils.lastErrorNew Utilities:
isFetching- Check if query is currently fetching (initial or background)isRefetching- Check if query is refetching in backgroundisLoading- Check if query is loading for first timedataUpdatedAt- Get timestamp of last successful data updatefetchStatus- Get current fetch status ('fetching' | 'paused' | 'idle')Use Cases:
Example Usage:
@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
Fix dependency bundling issues by moving @tanstack/db to peerDependencies (#766)
What Changed:
Moved
@tanstack/dbfrom regular dependencies to peerDependencies in:@tanstack/offline-transactions@tanstack/query-db-collectionRemoved
@opentelemetry/apidependency from@tanstack/offline-transactions.Why:
These extension packages incorrectly declared
@tanstack/dbas both a regular dependency AND a peerDependency simultaneously. This caused lock files to develop conflicting versions, resulting in multiple instances of@tanstack/dbbeing installed in consuming applications.The fix removes
@tanstack/dbfrom regular dependencies and keeps it only as a peerDependency. This ensures only one version of@tanstack/dbis installed in the dependency tree, preventing version conflicts.For local development,
@tanstack/dbremains in devDependencies so the packages can be built and tested independently.Updated dependencies [
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
Fix flushSync error in Svelte 5 async compiler mode (#745)
Previously,
useLiveQuerythrew an error when Svelte 5's async compiler mode was enabled:This occurred because
flushSync()was called inside theonFirstReadycallback, which executes within a$effectblock. Svelte 5's async compiler enforces a strict rule thatflushSync()cannot be called inside effects, as documented at svelte.dev/e/flush_sync_in_effect.The Fix:
Removed the unnecessary
flushSync()call from theonFirstReadycallback. Svelte 5's reactivity system automatically propagates state changes without needing synchronous flushing. This matches the pattern already used in Vue's implementation.Compatibility:
How to enable async mode:
Fixes svelte-db: flushSync inside effect breaks Svelte 5 async compiler mode #744
Updated dependencies [
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
6c55e16,7805afb,1367756]:@tanstack/[email protected]
Patch Changes
503f0b2,1367756]: