Repository navigation
Conversation
…ged operation
A failed foreground reload in useDatasetQuery cleared data, so an app that
polls with reload() blanked out on one failed request. A failed reload now
keeps the last good data and revision beside the error, and a transient
failure keeps a pending live refresh.
useDatasetPages follows nextCursor with { ...input, after } and returns every
page. It shares useDatasetQuery's scope, abort, and live-update handling,
retries a rate-limited page at its cursor, restarts a read whose pages came
from different revisions, and refuses a missing or repeated nextCursor.
Closes #4553
Closes #4565
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Problem
useDatasetQuerycleareddatawhen areload()failed. Share links get no dataset change events, so apps poll withreload(), and one failed poll blanked a live scoreboard or bracket (A failed useDatasetQuery reload throws away the last good data, so a polling app blanks out on one network blip #4553).useDatasetQueryreturns one page of a cursor-paged operation. Apps that list a whole gallery or ledger wrote their own page loop, request token, live reloads, and retry, as the Lightbox example does (useDatasetQuery returns only the first page of a cursor-paged operation, so apps hand-roll paging, live reloads, and debouncing #4565).Change
dataandrevisionbesideerror.datastill clears when the operation, input, or Collection changes. If a change event arrives around a reload that fails with 429 or 503, the hook retries in the background as it already did for live refreshes.useDatasetPages<Page>(operation, input, options)indohc/app. It sendsinput, then{ ...input, after: nextCursor }untilnextCursorisnull, and returns the pages in order. It sharesuseDatasetQuery's scope keys, aborts, live rereads,enabled,dataset,live, andreload.retryAfterMs(2 s if absent) and asks for the same page again. Share links allow 30 requests in a burst, so a read of more than 30 pages would otherwise never finish.nextCursor, or a cursor it already followed, fails with a 400 that names the operation.groupByreads (nextGroupCursor) don't silently look complete, and a stuck cursor can't loop.docs/reference/app-kit.md: the hook, the paging rules, and the minimal example now keep showing data beside an error.Closes #4553
Closes #4565
Verification
packages/app-kitvitest on the rebased head: 42 of 42 pass. The 5 new tests failed before the fix: failed reload keeps data and clears on input change, catch-up after a failed reload (3 flows), multi-page read with live reread, input change mid-read and failed reread, and 429 retry, torn-read restart, repeated and missing cursor.tscfor app-kit,oxlintover the repository, andoxfmtare clean.apps/desktopclosedAppCompiler.test.ts: 34 of 34 pass.useDatasetPagesread 45 pages (135 items). A write throughuseDatasetMutationreread 46 pages live. A failedreload()(409 refusal) kept the old value beside the error. No console errors besides the browser's network line for that deliberate 409.Council review
Design: one round, all three seats said revise. Folded in: 429 retry at the same cursor, required and non-repeating
nextCursor, torn-read restart, pending live refresh after a failed reload, and the docs example.Rounds: 3 in total (1 pre-pass, 2 council). Size: +97 product lines (budget 75 after the design council).
Sol's two blockers were the same bug in two forms: a live change that arrived around a manual
reload()was dropped if that reload failed with 503. Both are fixed and covered by the extended catch-up test.Follow-ups:
retryAfterMs, at most 1 h) or show the 429 after a few tries.useDatasetPageswaits out a 429 rather than showing it.reload()so polling doesn't fliploading.groupBy(nextGroupCursor) and offset-paged reads.input. A clear message for the non-objectinput400, and an input type that accepts interfaces.useDatasetPages.🤖 Generated with Claude Code