Skip to content

Commit

Permalink
[flow] Eliminate usage of more than 1-arg React.AbstractComponent i…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
SamChou19815 committed Oct 21, 2024
1 parent 750a0e4 commit bd06b96
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 96 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-native-fb-b8ae38f8-20241018
19.0.0-native-fb-45804af1-20241021
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<1f1399e9fe0f1bfa130bc796943b0554>>
* @generated SignedSource<<793d57c1e9f1c6b971aca21d043d2f21>>
*/

"use strict";
Expand Down Expand Up @@ -420,5 +420,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8bc05e324822aae609cf6f750242a2ec>>
* @generated SignedSource<<8b38afb370047fb53563f5f6daa8ddf0>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8bc05e324822aae609cf6f750242a2ec>>
* @generated SignedSource<<8b38afb370047fb53563f5f6daa8ddf0>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b1adf5fbcf2b6118e3619e7b2f03d287>>
* @generated SignedSource<<c1b568c187b173b15a42db3491042934>>
*/

/*
Expand Down Expand Up @@ -25352,11 +25352,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-b8ae38f8-20241018" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-45804af1-20241021" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-native-fb-b8ae38f8-20241018\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-native-fb-45804af1-20241021\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25393,11 +25393,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -25541,5 +25541,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a25f1f66cbb4ef0610b278541f278c6f>>
* @generated SignedSource<<b0f746d4dfa36e822b278607ad45a410>>
*/

/*
Expand Down Expand Up @@ -15642,14 +15642,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1698 = React.version;
if (
"19.0.0-native-fb-b8ae38f8-20241018" !==
"19.0.0-native-fb-45804af1-20241021" !==
isomorphicReactPackageVersion$jscomp$inline_1698
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1698,
"19.0.0-native-fb-b8ae38f8-20241018"
"19.0.0-native-fb-45804af1-20241021"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15671,11 +15671,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2151 = {
bundleType: 0,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2152 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15779,4 +15779,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3972c76130df9ee34317d3802fca3b8f>>
* @generated SignedSource<<d450f897480401e2ac4d32ac3db37888>>
*/

/*
Expand Down Expand Up @@ -16296,14 +16296,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1788 = React.version;
if (
"19.0.0-native-fb-b8ae38f8-20241018" !==
"19.0.0-native-fb-45804af1-20241021" !==
isomorphicReactPackageVersion$jscomp$inline_1788
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1788,
"19.0.0-native-fb-b8ae38f8-20241018"
"19.0.0-native-fb-45804af1-20241021"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16325,11 +16325,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1795 = {
bundleType: 0,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018",
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$291 = 0;
Expand Down Expand Up @@ -16448,4 +16448,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<679d304c50640f2e226490c12b32c107>>
* @generated SignedSource<<97ee9e798ac0e46aa25a0c5bc764ca27>>
*/

/*
Expand Down Expand Up @@ -25413,11 +25413,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-b8ae38f8-20241018" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-45804af1-20241021" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-native-fb-b8ae38f8-20241018\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-native-fb-45804af1-20241021\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25454,11 +25454,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -25918,7 +25918,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e21fc2b716820323e0d8ae7cad1192f9>>
* @generated SignedSource<<f4a6514fd617c75e652f8e808a255e12>>
*/

/*
Expand Down Expand Up @@ -15653,14 +15653,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1699 = React.version;
if (
"19.0.0-native-fb-b8ae38f8-20241018" !==
"19.0.0-native-fb-45804af1-20241021" !==
isomorphicReactPackageVersion$jscomp$inline_1699
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1699,
"19.0.0-native-fb-b8ae38f8-20241018"
"19.0.0-native-fb-45804af1-20241021"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15682,11 +15682,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2154 = {
bundleType: 0,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15944,4 +15944,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e5170d9e4e736fc65a791eb76d807fcf>>
* @generated SignedSource<<0f8579e95288f455a430bd5811509318>>
*/

/*
Expand Down Expand Up @@ -16311,14 +16311,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1789 = React.version;
if (
"19.0.0-native-fb-b8ae38f8-20241018" !==
"19.0.0-native-fb-45804af1-20241021" !==
isomorphicReactPackageVersion$jscomp$inline_1789
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1789,
"19.0.0-native-fb-b8ae38f8-20241018"
"19.0.0-native-fb-45804af1-20241021"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16340,11 +16340,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1796 = {
bundleType: 0,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018",
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$291 = 0;
Expand Down Expand Up @@ -16617,7 +16617,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7dfb43b6a8a9b9c8767f29da83b35718>>
* @generated SignedSource<<7a33e8b22f8d5217af049c4044a1b89f>>
*/

"use strict";
Expand Down Expand Up @@ -15127,11 +15127,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -15276,5 +15276,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3e07baf358535ee777f8fa221817c571>>
* @generated SignedSource<<6c45a126fb5bcf418177e06a454679d6>>
*/

"use strict";
Expand Down Expand Up @@ -9483,14 +9483,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1344 = {
bundleType: 0,
version: "19.0.0-native-fb-b8ae38f8-20241018",
version: "19.0.0-native-fb-45804af1-20241021",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-b8ae38f8-20241018"
reconcilerVersion: "19.0.0-native-fb-45804af1-20241021"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1345 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -9626,4 +9626,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-b8ae38f8-20241018";
exports.version = "19.0.0-native-fb-45804af1-20241021";
Loading

0 comments on commit bd06b96

Please sign in to comment.