Comments (1)
this might be a duplicate of #27729
(i guess it comes up in an RSC scenario because client references are wrapped with Lazy?)
I've been debugging this alongside @ziir, and I've managed to whittle this down to a much smaller repro that doesn't involve RSC at all, just a Thenable<ReactNode>
that contains a lazy component with a use() call inside.
"A nested promise for Use" is what's in the promise that gets use()
-ed. But the use()
returns a whole chunk of other stuff instead.
I believe this is related to lazy()
components, because uncommenting this bit here actually stops the issue from appearing:
const LazyUse = lazy(() => sleep(20).then(() => ({ default: Use })));
// const LazyUse = Use; // fixes the issue!
In summary, the issue seems to go like this:
- Render a promise (
promise1
) of JSX as a child of the shell - Have a lazy component in that JSX
- call
use(promise2)
within that lazy component. use will act as ifuse(promise1)
was called instead, so it returns the wrong thing.
Notably, this only seems to happen on the first request. The codesandbox caches the response so that it's easily viewable (also their preview does two requests, so it's not visible.)
Based on some poking around in the react internals, the issue seems to come from an incorrectly restored thenableState
. when the Use
component runs, thenableState
is set to an array containing the promise returned from getAsyncContent
instead of null, so use
just returns that (via this line in trackUsedThenable
). My guess is that this is somehow related to lazy()
using the legacy suspense implementation, but that's as far as i've gotten.
from react.
Related Issues (20)
- Bug: Weird behavior of form when i set a state value within an onChange handler. HOT 3
- Content-Security-Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). HOT 2
- Bug: React component rendered with createPortal with state controlled by parents will not rerender on state change HOT 3
- image decoder failed HOT 1
- Bug: Can't send ArrayBuffer to Server Action despite react.dev saying so HOT 7
- Bug: [React Refresh] Unexpected behavior when adding/removing elements prior to uncontrolled inputs HOT 7
- Elements with visible text labels do not have matching accessible names. HOT 1
- [DevTools Bug]: Source map error: URL: react_devtools_backend_compact.js.map HOT 2
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [BEST-METHODE]: Monopoly GO!! Free Dice Rolls Links (January 2024) [UNITED STATES]
- [DevTools Bug]: Memory Leak HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.