GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add Promise as a child test to Flight fixture by eps1lon · Pull Request #28778 · react/react

Conversation

@eps1lon

@eps1lon eps1lon commented Apr 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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.

All reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 8, 2024
@react-sizebot

react-sizebot commented Apr 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: f86afca...4b32fda

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 168.90 kB 168.90 kB = 52.69 kB 52.69 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 170.71 kB 170.71 kB = 53.24 kB 53.24 kB
facebook-www/ReactDOM-prod.classic.js = 590.23 kB 590.23 kB = 103.62 kB 103.62 kB
facebook-www/ReactDOM-prod.modern.js = 566.56 kB 566.56 kB = 99.57 kB 99.57 kB
test_utils/ReactAllWarnings.js Deleted 64.04 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.04 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Generated by 🚫 dangerJS against 4b32fda

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eps1lon added 2 commits April 8, 2024 13:13
@eps1lon
Add Promise as a child to Flight fixture
91ac3b9
@eps1lon
Revert "Suspend Thenable/Lazy if it's used in React.Children and unwr…
74b1848
…ap (react#28284)"

This reverts commit 9e7944f.
@eps1lon
eps1lon force-pushed the test/promise-as-a-child branch from f877090 to 74b1848 Compare April 8, 2024 11:13
@eps1lon
Revert "Revert "Suspend Thenable/Lazy if it's used in React.Children …
4b32fda
…and unwrap (react#28284)""

This reverts commit 74b1848.
@eps1lon eps1lon changed the title Add Promise as a child to Flight fixture Add Promise as a child test to Flight fixture Apr 8, 2024
@eps1lon
eps1lon marked this pull request as ready for review April 8, 2024 11:25
@eps1lon
eps1lon requested a review from sebmarkbage April 8, 2024 11:25
@sebmarkbage

sebmarkbage commented Apr 8, 2024

Copy link
Copy Markdown
Contributor

Wait how does that PR fix it? That was intended more as a performance optimization.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon

eps1lon commented Apr 8, 2024

Copy link
Copy Markdown
Collaborator Author

I didn't dig further yet. But reverting the PR does produce the hydration error. Maybe it was https://github.com/facebook/react/pull/28284/files#r1483763696 specifically that fixed it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage approved these changes Apr 8, 2024
View reviewed changes

@sebmarkbage sebmarkbage left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
@eps1lon
eps1lon merged commit e63918d into react:main Apr 8, 2024
@eps1lon
eps1lon deleted the test/promise-as-a-child branch April 8, 2024 15:06
rickhanlonii pushed a commit that referenced this pull request Apr 11, 2024
@eps1lon @rickhanlonii
Add Promise as a child test to Flight fixture (#28778)
0aae54c
rickhanlonii pushed a commit that referenced this pull request Apr 11, 2024
@eps1lon @rickhanlonii
Add Promise as a child test to Flight fixture (#28778)
96c8e74
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@eps1lon @AndyPengc12
Add Promise as a child test to Flight fixture (react#28778)
5e32c42
This was referenced Apr 24, 2024
Update React from c3048aab4 to cb151849e1 vercel/next.js#64994
Closed
Support React 19 in App and Pages router vercel/next.js#65058
Merged
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@eps1lon
Add Promise as a child test to Flight fixture (react#28778)
fb41d55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@sebmarkbage sebmarkbage sebmarkbage approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

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.

4 participants

@eps1lon @react-sizebot @sebmarkbage @facebook-github-bot
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.