feat(db): opt in to provisional initial ordered results - #2010
Draft
alec-watts wants to merge 1 commit into
Draft
alec-watts wants to merge 1 commit into
alec-watts wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 3ca3769 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 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 |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Observed limitation
Kino uses ordered on-demand queries over locally available rows. When the ordered provider subset is still pending, the initial live-query Collection stays empty even though matching cached rows exist. Rendering those rows sooner currently requires a local patch.
This proposes an opt-in
publishUnconfirmedOrderedResultsoption. The default remains to withhold the initial ordered window. With the option enabled, available local rows can publish while the initial Collection is loading, but initial-query readiness andpreload()still wait for provider coverage. Cached order is not authoritative: missing provider rows can change window membership and order.The change extends the existing publication gate; it does not add a parallel loading or persistence mechanism. Failure, replay, repair, and joined-demand holds stay intact. Explicit window moves stay atomic, including a move started while the initial Collection is still loading.
React already forwards config through the shared query resolver, so no duplicate hook forwarding path is needed on current main. The option participates in derived config identity so switching publication policy does not reuse a Collection with the previous policy. No generated/dist files are committed.
Related upstream work
Searched open PRs and exact option/provisional/unconfirmed/cached-ordered/on-demand-ordered terms before preparing this proposal; no equivalent opt-in asynchronous initial-publication PR was found.
Verification
[1], observed[]; default hold control passed.pnpm install --frozen-lockfileusing repository-pinned pnpm 11.1.0.@tanstack/db-ivm,@tanstack/db,@tanstack/react-db.git diff --checkpassed.These are scoped package checks, not a claim that the entire monorepo or real provider/network/browser matrix was tested. The new focused traces exercise the public Collection and React observation cuts; existing ordered/pagination oracles continue protecting the default atomic policy.
Why each file changes
packages/db/src/query/live/types.tspackages/db/src/query/live/collection-config-builder.tspackages/db/src/live-query-options.tspackages/db/tests/query/live-query-collection.test.tspackages/react-db/tests/useLiveQuery.test.tsxpackages/db/src/query/live/ARCHITECTURE.mddocs/guides/live-queries.md.changeset/provisional-initial-ordered-results.mdDiff cleanup found no formatting-only churn, parallel mechanism, or abandoned exports. Production change is 18 added lines and 1 removed line; tests and contract/docs are separate. Kino's local patches remain unchanged until an upstream release is available and verified.