Skip to content

Commit e91e02b

Browse files
kevin-dpclaude
andcommitted
fix(angular-db): config-object input to injectLiveQuery now syncs
The `{ query }` config-object branch called createLiveQueryCollection(opts) without defaulting startSync, unlike the query-fn and reactive-options branches (which force startSync: true). A bare `{ query }` therefore never synced and returned empty. Default startSync: true and gcTime: 0 while honoring explicit values in the config. Clears the angular-db conformance knownGap (config-object-input). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bed14e6 commit e91e02b

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@tanstack/angular-db': patch
3+
---
4+
5+
fix(angular-db): a `{ query }` config-object passed to `injectLiveQuery` now syncs
6+
7+
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.

packages/angular-db/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ export function injectLiveQuery(opts: any) {
194194
})
195195
}
196196

197-
// Handle LiveQueryCollectionConfig objects
197+
// Handle LiveQueryCollectionConfig objects. Default startSync/gcTime to
198+
// match the query-fn and reactive-options paths, but let an explicit value
199+
// in the config win — otherwise a bare `{ query }` never syncs.
198200
if (opts && typeof opts === `object` && typeof opts.query === `function`) {
199-
return createLiveQueryCollection(opts)
201+
return createLiveQueryCollection({ startSync: true, gcTime: 0, ...opts })
200202
}
201203

202204
throw new Error(`Invalid options provided to injectLiveQuery`)

packages/angular-db/tests/conformance.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,7 @@ const angularDriver: LiveQueryDriver = {
214214
mountCollection,
215215
mountConfig,
216216
mountDisabled,
217-
// Divergence the suite surfaced: angular-db's plain `{ query }` config-object
218-
// path calls createLiveQueryCollection(opts) as-is, without injecting
219-
// startSync:true the way the query-fn path does — so a bare `{ query }` never
220-
// syncs and returns empty. React/Vue/Svelte/Solid all auto-start a config
221-
// object; Angular requires an explicit `startSync: true` (its own config test
222-
// passes it). Recorded until angular-db aligns.
223-
knownGaps: [`config-object-input`],
217+
knownGaps: [],
224218
features: { serverSnapshot: false, suspense: false },
225219
}
226220

0 commit comments

Comments
 (0)