Skip to content
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

[flow] Eliminate usage of more than 1-arg React.AbstractComponent in React codebase #31314

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

SamChou19815
Copy link
Contributor

Summary

In order to adopt react 19's ref-as-prop model, Flow needs to eliminate all the places where they are treated differently. React.AbstractComponent is the worst example of this, and we need to eliminate it.

This PR eliminates them from the react repo, and only keeps the one that has 1 argument of props.

How did you test this change?

yarn flow

Copy link

vercel bot commented Oct 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 10:56pm

@react-sizebot
Copy link

react-sizebot commented Oct 21, 2024

Comparing: 69d4b80...6cb6f06

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.js = 6.68 kB 6.68 kB = 1.83 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 506.86 kB 506.86 kB = 90.71 kB 90.71 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 511.79 kB 511.79 kB = 91.42 kB 91.42 kB
facebook-www/ReactDOM-prod.classic.js = 604.26 kB 604.26 kB = 106.92 kB 106.92 kB
facebook-www/ReactDOM-prod.modern.js = 580.48 kB 580.48 kB = 103.01 kB 103.01 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/shims/ReactNativeTypes.js +1.01% 8.32 kB 8.41 kB +1.97% 2.18 kB 2.22 kB

Generated by 🚫 dangerJS against 91ee442

@SamChou19815 SamChou19815 merged commit 45804af into main Oct 21, 2024
184 checks passed
@SamChou19815 SamChou19815 deleted the eliminate-abstract-component branch October 21, 2024 23:17
github-actions bot pushed a commit that referenced this pull request Oct 21, 2024
…n React codebase (#31314)

<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

In order to adopt react 19's ref-as-prop model, Flow needs to eliminate
all the places where they are treated differently.
`React.AbstractComponent` is the worst example of this, and we need to
eliminate it.

This PR eliminates them from the react repo, and only keeps the one that
has 1 argument of props.

## How did you test this change?

yarn flow

DiffTrain build for [45804af](45804af)
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Oct 22, 2024
Summary:
Pull Request resolved: #47150

In facebook/react#31314, I will change the host component type that will be synced to react-native. Notably, it will expose the issue where all the `HostComponent<mixed>` types are wrong, since it doesn't make sense to write `React.AbstractComponent<mixed>`. This diff fixes the existing usages first in prep for that typing change.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64722939

fbshipit-source-id: 14e1477090128205d8be8fc7b135a8478f94b790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants