mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
Throw a better error when Lazy/Promise is used in React.Children (#28280)
We could in theory actually support this case by throwing a Promise when it's used inside a render. Allowing it to be synchronously unwrapped. However, it's a bit sketchy because we officially only support this in the render's child position or in `use()`. Another alternative could be to actually pass the Promise/Lazy to the callback so that you can reason about it and just return it again or even unwrapping with `use()` - at least for the forEach case maybe.
This commit is contained in:
committed by
GitHub
parent
cd63ef7921
commit
e41ee9ea70
@@ -489,5 +489,6 @@
|
||||
"501": "The render was aborted with postpone when the shell is incomplete. Reason: %s",
|
||||
"502": "Cannot read a Client Context from a Server Component.",
|
||||
"503": "Cannot use() an already resolved Client Reference.",
|
||||
"504": "Failed to read a RSC payload created by a development version of React on the server while using a production version on the client. Always use matching versions on the server and the client."
|
||||
"504": "Failed to read a RSC payload created by a development version of React on the server while using a production version on the client. Always use matching versions on the server and the client.",
|
||||
"505": "Cannot render an Async Component, Promise or React.Lazy inside React.Children. We recommend not iterating over children and just rendering them plain."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user