GeezerVison is showing github.com — Add Promise as a child test to Flight fixture by eps1lon · Pull Request #28778 · react/react
Conversation
eps1lon
commented
Apr 8, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Adds a test for promise as a child that was fixed by #28284. Since the fix only included tests for React.Children I also added another regression test based on the original bug report in #27247.
Test plan
I can't repro this in our unit test suite so I use the Flight fixture which fails on any console error.
- Reverting the fix fails CI: https://app.circleci.com/pipelines/github/facebook/react/51990/workflows/d89bc4f1-0ae0-4694-a7ed-a922ec4a7c66/jobs/828188
Error: expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 38
- Array []
+ Array [
+ "Error: Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
+
+ - A server/client branch `if (typeof window !== 'undefined')`.
+ - Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
+ - Date formatting in a user's locale which doesn't match the server.
+ - External changing data without sending a snapshot of it along with the HTML.
+ - Invalid HTML tag nesting.
+
+ It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
+
+ https://react.dev/link/hydration-mismatch
+
+ <Shell data={[...]}>
+ <link>
+ <App>
+ <html lang=\"en\">
+ <head>
+ <body>
+ <Container>
+ <div>
+ <h1>
+ <Suspense fallback={null}>
+ + <div data-testid=\"promise-as-a-child-test\">
+ - Promise as a child hydrates without errors:
+ ...
+
+ at throwOnHydrationMismatch (http://localhost:3000/static/js/bundle.js:20903:19)
+ at tryToClaimNextHydratableInstance (http://localhost:3000/static/js/bundle.js:20948:9)
+ at updateHostComponent$1 (http://localhost:3000/static/js/bundle.js:30288:9)
+ at beginWork (http://localhost:3000/static/js/bundle.js:31858:18)
+ at replaySuspendedUnitOfWork (http://localhost:3000/static/js/bundle.js:38668:20)
+ at renderRootConcurrent (http://localhost:3000/static/js/bundle.js:38366:21)
+ at performConcurrentWorkOnRoot (http://localhost:3000/static/js/bundle.js:37342:42)
+ at workLoop (http://localhost:3000/static/js/bundle.js:49707:38)
+ at flushWork (http://localhost:3000/static/js/bundle.js:49677:18)
+ at MessagePort.performWorkUntilDeadline (http://localhost:3000/static/js/bundle.js:49975:25)",
+ ]
19 |
20 | await expect(consoleErrors).toEqual([]);
> 21 | await expect(pageErrors).toEqual([]);
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Comparing: f86afca...4b32fda
Critical size changes
Includes critical production bundles, as well as any change greater than 2%:
Significant size changes
Includes any change greater than 0.2%:
Expand to show
Generated by 🚫 dangerJS against 4b32fda
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
eps1lon
changed the title
Add Promise as a child to Flight fixture
Add Promise as a child test to Flight fixture
Apr 8, 2024
|
Wait how does that PR fix it? That was intended more as a performance optimization.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
There seems to be something off about that logic if that's necessary. Maybe there's other cases it's broken too.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Apr 24, 2024
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.