Skip to content
Source
Sign inSign up
TanStack/db

fix(angular-db): config-object input to injectLiveQuery now syncs #1638

Mergedkevin-dp(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/1638/headmerged by kevin-dp(GitHub profile, opens in a new tab)

Showing 3 changed files with 12 additions and 9 deletions.

x
0 of 3 viewed, 3 left
7 additions and 0 deletions.changeset/angular-config-object-startsync.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/angular-db': patch
+---
+​
+fix(angular-db): a `{ query }` config-object passed to `injectLiveQuery` now syncs
+​
+The config-object branch called `createLiveQueryCollection(opts)` without defaulting `startSync`, unlike the query-function and reactive-options branches (which force `startSync: true`), so a bare `{ query }` never started syncing and produced no data. It now defaults `startSync: true` and `gcTime: 0` while still honoring any explicit values in the config.
4 additions and 2 deletionspackages/angular-db/src/index.tsModified
View file
@@ -194,9 +194,11 @@
​
- // Handle LiveQueryCollectionConfig objects
+ // Handle LiveQueryCollectionConfig objects. Default startSync/gcTime to
+ // match the query-fn and reactive-options paths, but let an explicit value
+ // in the config win — otherwise a bare `{ query }` never syncs.
if (opts && typeof opts === `object` && typeof opts.query === `function`) {
- return createLiveQueryCollection(opts)
+ return createLiveQueryCollection({ startSync: true, gcTime: 0, ...opts })
​
throw new Error(`Invalid options provided to injectLiveQuery`)