preactjs / preactjs/preact

Support `REACT_RECOVERABLE_TYPE` in `use`

Open
#5,261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
JavaScript
Stars
38.9k
Forks
2.4k
Avg merge
20h 18m
Merged PRs (30d)
35

Description

Describe the feature you'd love to see
A clear and concise description of what you'd love to see added to Preact.

In React 19.3, browser is introducted to use with use for early return on non-browser environments. https://react.dev/blog/2026/09/09/react-19-3#new-react-dom-features

Inside use, they used REACT_RECOVERABLE_TYPE for returning undefined.

https://github.com/react/react/blob/main/packages/react-dom/src/shared/ReactDOMBrowser.js

https://github.com/react/react/blob/9b9385327857d1211fb4dc022122d897fb38bc5a/packages/react-reconciler/src/ReactFiberHooks.js#L1167-L1171

In ReactLynx, we have dual-thread concept, we are planning to provide some API like browser but for background thread, the API may be like:

function CameraPanel() {
  use(background('Camera APIs are unavailable on Main Thread'));
  // IFR (main thread) does not go here
  const camera = NativeModules.Camera;
  return <CameraView camera={camera} />;
}

Will use API support something like REACT_RECOVERABLE_TYPE for safely return nothing and continuing rendering?

Additional context (optional)
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Preact's use entry point and compare its behavior with the referenced React files: ReactDOMBrowser.js and ReactFiberHooks.js around lines 1167–1171. Clarify how a recoverable value or background-thread API should behave, then define tests for safely continuing rendering when the condition is encountered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.