mirror of
https://github.com/facebook/react.git
synced 2026-02-24 04:33:04 +00:00
[Fizz] Send errors down to client (#24551)
* use return from onError * export getSuspenseInstanceFallbackError * stringToChunk * return string from onError in downstream type signatures * 1 more type * support encoding errors in html stream and escape user input This commit adds another way to get errors to the suspense instance by encoding them as dataset properties of a template element at the head of the boundary. Previously if there was an error before the boundary flushed there was no way to stream the error to the client because there would never be a client render instruction. Additionally the error is sent in 3 parts 1) error hash - this is always sent (dev or prod) if one is provided 2) error message - Dev only 3) error component stack - Dev only, this now captures the stack at the point of error Another item addressed in this commit is the escaping of potentially unsafe data. all error components are escaped as test for browers when written into the html and as javascript strings when written into a client render instruction. * nits Co-authored-by: Marco Salazar <salazarm@fb.com>
This commit is contained in:
@@ -416,5 +416,6 @@
|
||||
"428": "useServerContext is only supported while rendering.",
|
||||
"429": "ServerContext: %s already defined",
|
||||
"430": "ServerContext can only have a value prop and children. Found: %s",
|
||||
"431": "React elements are not allowed in ServerContext"
|
||||
"431": "React elements are not allowed in ServerContext",
|
||||
"432": "This Suspense boundary was aborted by the server"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user