forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fizz] Fix Client Render after Postpone (facebook#27905)
If we end up client rendering a boundary due to an error after we have already injected a postponed hole in that boundary we'll end up trying to target a missing segment. Since we never insert segments for an already errored boundary into the HTML. Normally an errored prerender wouldn't be used but if it is, such as if it was an intentional client error it triggers this case. Those should really be replaced with postpones though. This is a bit annoying since we eagerly build up the postponed path. I took the easy route here and just cleared out the suspense boundary itself from having any postponed slots. However, this still creates an unnecessary replay path along the way to the boundary. We could probably walk the path and remove any empty parent nodes. What is worse is that if this is the only thing that postponed, we'd still generate a postponed state even though there's actually nothing to resume. Since this is a bit of an edge case already maybe it's fine. In my test I added a check for the `error` event on `window` since this error only surfaces by throwing an ignored error. We should really do that globally for all tests. Our tests should fail by default if there's an error logged to the window.
- Loading branch information
1 parent
6550366
commit b73e3fd
Showing
2 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters