-
Notifications
You must be signed in to change notification settings - Fork 102
eagerly run live queries while collections are loading #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 2816a73 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
Size Change: +222 B (+0.29%) Total Size: 76.3 kB
ℹ️ View Unchanged
|
Size Change: 0 B Total Size: 1.47 kB ℹ️ View Unchanged
|
d2d3004
to
2816a73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! I don't think this would show up as improvement in our current benchmarks but for anything that does chunked loading like electric, this should be quite a bit faster.
❤️ works like a charm - closing #641 |
Summary
Refactors the live query execution model to support eager materialization. Live queries now process and display data as it arrives from source collections during sync, rather than waiting for all source collections to reach a "ready" state before executing.
Key Changes
.preload()
or.startSync()
, processing data as it arrives from source collectionson('status:change')
event listeners, whilesubscribeChanges
is used solely for data updatesinitialCommit
status from collection lifecycle across entire codebaseloading
state to support eager query execution_lifecycle
property public on Collection interface for internal library useinitialCommit
references and validate eager execution behaviorTesting
Core Package (
@tanstack/db
):query-while-syncing.test.ts
(24 tests covering basic queries, joins, multiple sources, error handling, and both.startSync()
and.preload()
patterns)markReady()
in collection testsdescribe.each
pattern for parameterized testing with bothautoIndex: 'off'
andautoIndex: 'eager'
Framework Packages:
isLoading == true
:@tanstack/react-db
): 4 new tests (33 total)@tanstack/vue-db
): 4 new tests (23 total)@tanstack/solid-db
): 4 new tests (20 total)@tanstack/svelte-db
): 4 new tests (22 total)@tanstack/angular-db
): 3 new tests (18 total)isLoading == true
initialCommit
references in framework adapter implementationsTest Coverage:
User-Facing Impact
Users will see live query results update in real-time as data loads, providing immediate feedback during sync operations. This includes both synced data and local optimistic updates, creating a more responsive user experience even before the underlying data is fully loaded. They can use the collection status to show loading state while the data streams in. This behavior is consistent across all framework adapters (React, Vue, Solid, Svelte, Angular).