Skip to content

[pull] main from react:main - #625

Merged
pull[bot] merged 2 commits into
code:mainfrom
react:main
Jul 31, 2026
Merged

[pull] main from react:main#625
pull[bot] merged 2 commits into
code:mainfrom
react:main

Conversation

@pull

@pull pull Bot commented Jul 31, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

hoxyq and others added 2 commits July 31, 2026 15:24
This is a cherry-pick of #34030, with
a feature flag gating and a test coverage.

The flag is disabled by default and dynamic for FB builds to understand
first how noisy this warning can be.

---

See #34030 for more context on the
change.
Added behind a new experimental flag, `enableFlightWeakThenables`.

Adds a new thenable status to the Flight protocol: `'pending_weak'`.
Unlike a regular pending thenable, a weak thenable does not block the
stream from closing. If it settles while the stream is still open, its
value is emitted like a normal pending thenable. Otherwise its reference
is left unfulfilled and on the client it stays forever pending, without
erroring, even when the connection closes. It's up to the client to
handle the unresolved promise in an appropriate way.

The motivating use case is being able to encode metadata about a Flight
stream into the response itself. For example, a framework might want to
track whether a page varies by search params. It could represent this in
the response as a `Promise<boolean>` that resolves to `true` as soon as
the component being rendered in the stream accesses search params. If
the thenable never resolves by the time the stream closes, then the
client knows that no search params were ever accessed.

In the future we could add a higher-level API for encoding this kind of
information. For now, we intentionally start with the low-level
primitive so frameworks can experiment in userspace without adding
significantly to React's surface area.

Internally, Flight already uses its own private thenable statuses, like
`'resolved_model'`, and the protocol is designed to treat any status
besides `'fulfilled'` and `'rejected'` as equivalent to `'pending'`, so
`'pending_weak'` slots into the existing machinery. On the wire, a weak
reference is encoded as `$w<id>`, next to `$@<id>` for regular promises,
so the client knows its row may intentionally never arrive. On the
client, a weak reference behaves like any other pending promise until
the response closes; then, instead of erroring, it is left forever
pending.
@pull pull Bot locked and limited conversation to collaborators Jul 31, 2026
@pull pull Bot added the ⤵️ pull label Jul 31, 2026
@pull
pull Bot merged commit 9b5b4d5 into code:main Jul 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants