Repository navigation
chore: merge upstream facebook/react main - #5
Merged
Merged
Conversation
Adds the remaining built-in Ledger kinds. Ledgers are limited to a fixed set of built-in kinds. There is no generic Ledger constructor, by design. We could consider adding one later if a compelling use case arises. All the built-in kinds follow certain algebraic properties: - Monotonicity. A write in one component must not cancel out a write in a different component. For example, once a bit is set in a Mask ledger, it can never be unset. - Commutativity. The order of writes should not affect the final total. This allows us to stream parallel parts of the graph independently, without buffering them to preserve write order. - Associativity. Grouping writes into partial totals must not affect the final total. This allows us to accumulate and merge totals incrementally. If a stream is intentionally closed early during partial prerendering, its total describes the portion that was received. The built-in Ledger kinds are: - `createBitLedger`. Flips a flag from false to true. - `createMaskLedger`. Adds bits to a bitmask. - `createMinLedger`. Tracks the smallest number. - `createMaxLedger`. Tracks the largest number. - `createSetLedger`. Accumulates a Set of scalar values. There's a caveat regarding Set Ledgers: Sets in JavaScript have an iteration order, but React does not guarantee anything about the order of the entries in the final Set. The order is considered undefined and consumers must not rely on it. Sets also only support scalar values for now, not objects. This is because object identity is not a good basis for set equality. We may add support for sets of arbitrary values later, though we'll need to consider the identity question again. Min and Max Ledgers reject NaN. NaN is neither smaller nor larger than any number, so the total would depend on the order of the writes. Set entries are checked against the taint registry, like any other value sent to the client. A tainted entry throws from addToLedger, so the component that wrote it errors. Entries are checked again when they're emitted, which catches a value tainted after it was written. That check runs outside any task, so it fails the request.
Test suite for Ledgers. I've moved these tests to their own PR at the end of the stack for the reviewer's convenience, to give a better sense of how much implementation is involved in each of the previous PRs.
Adds support for consuming a Ledger total from a response and rendering
it inside a new Flight response ("forwarding"), while preserving the
incremental nature of the accumulated total. If the new Flight render is
aborted during partial prerendering before the original response has
finished, the Ledger in the new response will represent only the data
that had been decoded up to that point.
This differs from embedding the total into the new response as a regular
thenable or promise, e.g. `Promise.resolve(ledgerTotal)`. Such a promise
would only resolve when the original response has finished streaming; by
design, you cannot observe a partial total.
To get the partial total, you must pass the special Ledger thenable
directly to the new response without unwrapping it. This makes it harder
to accidentally observe a total that is out of sync with its
corresponding data.
Forwarding is incremental. Each destination resumes a Set total where it
left off, rather than rescanning it on every batch, so a total that
grows by one entry per batch costs linear time. The forwarded total and
its entries go through the same taint checks as any other value sent to
the client.
No new public API is required.
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. |
|
The size diff is too large to display in a single comment. This workflow run contains an artifact called Generated by sizebot against 6485c81 |
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
chore: merge upstream facebook/react main DiffTrain build for [fb031f0](react@fb031f0)
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.
Summary
This PR merges the latest
facebook/reactmainbranch into the fork'smainbranch. It uses a merge commit, so the upstream history is kept. The merge had no conflicts, and the fork's own changes are unchanged.Upstream head: react/react@edae846
Merged upstream commits
How did you test this change?
Local validation was not performed. CI on this PR will check the merge.
🤖 Generated with Claude Code