mirror of
https://github.com/react/react.git
synced 2026-09-29 05:33:03 +08:00
Implements `captureLedgers` on the server. This wraps around part of the Flight rendering graph and captures its Ledger effects. Like with previous steps, decoding on the client is still not implemented; will be added in later PRs. The previous PR already implemented most of the changes to the wire protocol, including the `Y` row type that represents a `captureLedgers` instance. In addition to writing Ledger declarations to the response stream, we also introduce two internal, renderable types recognized by Flight: - A LedgerDataObject is the `data` field returned by `captureLedgers`. It is the wrapped version of the model object passed as the first argument to `captureLedgers`, and renders to the same data as the original object; the only difference is that it also tracks any Ledger writes that occur during rendering. - A LedgerTotal is an entry in the `ledgers` array returned by `captureLedgers`. It renders to a thenable that resolves to the final Ledger total, resolving only once the client stream has closed. It cannot be read on the server.