Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/angular-config-object-startsync.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions packages/angular-db/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ export function injectLiveQuery(opts: any) {
})
}

// 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`)
Expand Down
8 changes: 1 addition & 7 deletions packages/angular-db/tests/conformance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,7 @@ const angularDriver: LiveQueryDriver = {
mountCollection,
mountConfig,
mountDisabled,
// Divergence the suite surfaced: angular-db's plain `{ query }` config-object
// path calls createLiveQueryCollection(opts) as-is, without injecting
// startSync:true the way the query-fn path does — so a bare `{ query }` never
// syncs and returns empty. React/Vue/Svelte/Solid all auto-start a config
// object; Angular requires an explicit `startSync: true` (its own config test
// passes it). Recorded until angular-db aligns.
knownGaps: [`config-object-input`],
knownGaps: [],
features: { serverSnapshot: false, suspense: false },
}

Expand Down
Loading