Skip to content

Port more tests to the Scheduler.unstable_yieldValue pattern and drop internal.js#18549

Merged
sebmarkbage merged 6 commits intofacebook:masterfrom
sebmarkbage:disablelogsindoublerender
Apr 9, 2020
Merged

Port more tests to the Scheduler.unstable_yieldValue pattern and drop internal.js#18549
sebmarkbage merged 6 commits intofacebook:masterfrom
sebmarkbage:disablelogsindoublerender

Conversation

@sebmarkbage
Copy link
Copy Markdown
Contributor

This rewrites all the tests that overrides debugRenderPhaseSideEffectsForStrictMode to be agnostic of if they double render. The easiest way to do that is to use Scheduler.unstable_yieldValue pattern. So I converted a bunch of ops.push(...) to that.

We also use the pattern where we store this in render as a side-effect that needed to be ported too.

Then drops the .internal.js suffix from a few more files that don't need it anymore.

This also surfaced that we call the fake double render on setState updater on classes before the main one. This causes deduping to silence warnings. So I changed it to happen after the main one instead.

@sebmarkbage sebmarkbage requested a review from acdlite April 9, 2020 02:59
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 9, 2020
Copy link
Copy Markdown
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Apr 9, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7e2d244:

Sandbox Source
angry-mountain-k43v6 Configuration

@sizebot
Copy link
Copy Markdown

sizebot commented Apr 9, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against 7e2d244

@sizebot
Copy link
Copy Markdown

sizebot commented Apr 9, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against 7e2d244

Comparing the elementType doesn't work for this because it will never be
the same for a simple element.

This caused us to double validate these. This was covered up because in
internal tests this was deduped since they shared the prop types cache
but since we now inline it, it doesn't get deduped.
'prop',
getComponentName(outerMemoType),
);
}
Copy link
Copy Markdown
Contributor Author

@sebmarkbage sebmarkbage Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaearon This avoids checking prop-types unless it's lazy. Comparing the elementType doesn't work for this because it will never be the same for a simple memo component.

This caused us to double validate these. This was covered up because in internal tests this was deduped since they shared the prop types cache but since we now inline it, it doesn't get deduped. Since the dedupe cache is not shared by the renderer and isomorphic. Now that we're running the tests against builds, we caught this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just shows how dangerous it can be to have module state in /shared/.

@sebmarkbage sebmarkbage merged commit 147bdef into facebook:master Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants