-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress hydration warnings when a preceding sibling suspends #24404
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a9ccb8b
Add failing test case for #24384
gnoff b530537
Mark hydration as suspending on every thrownException
gnoff dc1cd0b
Fix failing test related to client render fallbacks
gnoff b06d2e9
Only mark didSuspend on suspense path
gnoff 5e1cd0a
gate test on hydration fallback flags
gnoff 668d8c9
refactor didSuspend to didSuspendOrError
gnoff 3bccb4d
factor tests to assert different behavior between prod and dev
gnoff eeede50
add DEV suffix to didSuspendOrError to better indicate this feature s…
gnoff c827582
move tests back to ReactDOMFizzServer-test
gnoff 945352e
fix comment casing
gnoff 07a2eee
drop extra flag gates in tests
gnoff 8839f1b
add test for user error case
gnoff 3fd1eb6
remove unnecessary gate
gnoff be1cefa
Make test better
gnoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,7 +285,7 @@ describe('ReactDOMServerPartialHydration', () => { | |
} | ||
try { | ||
const finalHTML = ReactDOMServer.renderToString(<App />); | ||
const container = document.createElement('div'); | ||
const container = document.createElement('section'); | ||
container.innerHTML = finalHTML; | ||
expect(Scheduler).toHaveYielded([ | ||
'Hello', | ||
|
@@ -350,12 +350,14 @@ describe('ReactDOMServerPartialHydration', () => { | |
); | ||
|
||
if (__DEV__) { | ||
expect(mockError.mock.calls[0]).toEqual([ | ||
const secondToLastCall = | ||
mockError.mock.calls[mockError.mock.calls.length - 2]; | ||
expect(secondToLastCall).toEqual([ | ||
'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', | ||
'div', | ||
'div', | ||
'article', | ||
'section', | ||
'\n' + | ||
' in div (at **)\n' + | ||
' in article (at **)\n' + | ||
Comment on lines
+353
to
+360
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning used to be for trying to match the first Component div against the Text node. It was an expression of sorts of the issue brought up in #24384 This warning now is the intentional mismatch between article and div that the test introduces between client/server renders. |
||
' in Component (at **)\n' + | ||
' in Suspense (at **)\n' + | ||
' in App (at **)', | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test, where there is no mismatch at all between client and server (and no emitted warnings)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks: #24436