Skip to content

Commit 8d80d81

Browse files
committed
[crud] Narrow resource type (#32203)
Small refactor to the `resource` type to narrow it to an arbitrary object or void/null instead of the top type. This makes the overload on useEffect simpler since the return type of create is no longer widened to the top type when we merge their definitions. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32203). * #32206 * #32205 * #32204 * __->__ #32203 DiffTrain build for [899e3d1](899e3d1)
1 parent ea2c5b2 commit 8d80d81

23 files changed

+101
-139
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.1.0-native-fb-cd90a4d8-20250210
1+
19.1.0-native-fb-899e3d12-20250211

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<b85aed506feb2e3b86e92b70d0bdd422>>
10+
* @generated SignedSource<<4d5eab0aae301fbdfd3163e7f76beedf>>
1111
*/
1212

1313
"use strict";
@@ -428,5 +428,5 @@ __DEV__ &&
428428
exports.useFormStatus = function () {
429429
return resolveDispatcher().useHostTransitionStatus();
430430
};
431-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
431+
exports.version = "19.1.0-native-fb-899e3d12-20250211";
432432
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a77ee5d5bcac5405162f03772b4c0164>>
10+
* @generated SignedSource<<7b223b23d0fa8467a58be2169fe7740d>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
206+
exports.version = "19.1.0-native-fb-899e3d12-20250211";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a77ee5d5bcac5405162f03772b4c0164>>
10+
* @generated SignedSource<<7b223b23d0fa8467a58be2169fe7740d>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
206+
exports.version = "19.1.0-native-fb-899e3d12-20250211";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5ea84f48b670a960c55ddb28fdb2f05a>>
10+
* @generated SignedSource<<c1f359240fa459f07017c0b9d6825895>>
1111
*/
1212

1313
/*
@@ -11228,11 +11228,7 @@ __DEV__ &&
1122811228
lastEffect = finishedWork;
1122911229
var nearestMountedAncestor =
1123011230
nearestMountedAncestor$jscomp$0,
11231-
resource = updateQueue.inst.resource,
11232-
destroy_ =
11233-
null == resource
11234-
? destroy
11235-
: destroy.bind(null, resource);
11231+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
1123611232
runWithFiberInDEV(
1123711233
lastEffect,
1123811234
callDestroyInDEV,
@@ -26039,11 +26035,11 @@ __DEV__ &&
2603926035
};
2604026036
(function () {
2604126037
var isomorphicReactPackageVersion = React.version;
26042-
if ("19.1.0-native-fb-cd90a4d8-20250210" !== isomorphicReactPackageVersion)
26038+
if ("19.1.0-native-fb-899e3d12-20250211" !== isomorphicReactPackageVersion)
2604326039
throw Error(
2604426040
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2604526041
(isomorphicReactPackageVersion +
26046-
"\n - react-dom: 19.1.0-native-fb-cd90a4d8-20250210\nLearn more: https://react.dev/warnings/version-mismatch")
26042+
"\n - react-dom: 19.1.0-native-fb-899e3d12-20250211\nLearn more: https://react.dev/warnings/version-mismatch")
2604726043
);
2604826044
})();
2604926045
("function" === typeof Map &&
@@ -26080,10 +26076,10 @@ __DEV__ &&
2608026076
!(function () {
2608126077
var internals = {
2608226078
bundleType: 1,
26083-
version: "19.1.0-native-fb-cd90a4d8-20250210",
26079+
version: "19.1.0-native-fb-899e3d12-20250211",
2608426080
rendererPackageName: "react-dom",
2608526081
currentDispatcherRef: ReactSharedInternals,
26086-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210"
26082+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211"
2608726083
};
2608826084
internals.overrideHookState = overrideHookState;
2608926085
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26227,5 +26223,5 @@ __DEV__ &&
2622726223
listenToAllSupportedEvents(container);
2622826224
return new ReactDOMHydrationRoot(initialChildren);
2622926225
};
26230-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
26226+
exports.version = "19.1.0-native-fb-899e3d12-20250211";
2623126227
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<1564f6f4d214e47e4d331939c4f48758>>
10+
* @generated SignedSource<<b779385d565ae6160e3bdd822322c603>>
1111
*/
1212

1313
/*
@@ -7821,9 +7821,7 @@ function commitHookEffectListUnmount(
78217821
) {
78227822
lastEffect = finishedWork;
78237823
var nearestMountedAncestor = nearestMountedAncestor$jscomp$0,
7824-
resource = updateQueue.inst.resource,
7825-
destroy_ =
7826-
null == resource ? destroy : destroy.bind(null, resource);
7824+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
78277825
try {
78287826
destroy_();
78297827
} catch (error) {
@@ -16018,14 +16016,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1601816016
};
1601916017
var isomorphicReactPackageVersion$jscomp$inline_1802 = React.version;
1602016018
if (
16021-
"19.1.0-native-fb-cd90a4d8-20250210" !==
16019+
"19.1.0-native-fb-899e3d12-20250211" !==
1602216020
isomorphicReactPackageVersion$jscomp$inline_1802
1602316021
)
1602416022
throw Error(
1602516023
formatProdErrorMessage(
1602616024
527,
1602716025
isomorphicReactPackageVersion$jscomp$inline_1802,
16028-
"19.1.0-native-fb-cd90a4d8-20250210"
16026+
"19.1.0-native-fb-899e3d12-20250211"
1602916027
)
1603016028
);
1603116029
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16047,10 +16045,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1604716045
};
1604816046
var internals$jscomp$inline_2262 = {
1604916047
bundleType: 0,
16050-
version: "19.1.0-native-fb-cd90a4d8-20250210",
16048+
version: "19.1.0-native-fb-899e3d12-20250211",
1605116049
rendererPackageName: "react-dom",
1605216050
currentDispatcherRef: ReactSharedInternals,
16053-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210"
16051+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211"
1605416052
};
1605516053
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1605616054
var hook$jscomp$inline_2263 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16154,4 +16152,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1615416152
listenToAllSupportedEvents(container);
1615516153
return new ReactDOMHydrationRoot(initialChildren);
1615616154
};
16157-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
16155+
exports.version = "19.1.0-native-fb-899e3d12-20250211";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5202b9e27c05bcbc804d9718c27fa755>>
10+
* @generated SignedSource<<cb31d915a8c9f43af76666e9c20be4f2>>
1111
*/
1212

1313
/*
@@ -8067,9 +8067,7 @@ function commitHookEffectListUnmount(
80678067
) {
80688068
lastEffect = finishedWork;
80698069
var nearestMountedAncestor = nearestMountedAncestor$jscomp$0,
8070-
resource = updateQueue.inst.resource,
8071-
destroy_ =
8072-
null == resource ? destroy : destroy.bind(null, resource);
8070+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
80738071
try {
80748072
destroy_();
80758073
} catch (error) {
@@ -16667,14 +16665,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1666716665
};
1666816666
var isomorphicReactPackageVersion$jscomp$inline_1897 = React.version;
1666916667
if (
16670-
"19.1.0-native-fb-cd90a4d8-20250210" !==
16668+
"19.1.0-native-fb-899e3d12-20250211" !==
1667116669
isomorphicReactPackageVersion$jscomp$inline_1897
1667216670
)
1667316671
throw Error(
1667416672
formatProdErrorMessage(
1667516673
527,
1667616674
isomorphicReactPackageVersion$jscomp$inline_1897,
16677-
"19.1.0-native-fb-cd90a4d8-20250210"
16675+
"19.1.0-native-fb-899e3d12-20250211"
1667816676
)
1667916677
);
1668016678
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16696,10 +16694,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1669616694
};
1669716695
var internals$jscomp$inline_1904 = {
1669816696
bundleType: 0,
16699-
version: "19.1.0-native-fb-cd90a4d8-20250210",
16697+
version: "19.1.0-native-fb-899e3d12-20250211",
1670016698
rendererPackageName: "react-dom",
1670116699
currentDispatcherRef: ReactSharedInternals,
16702-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210",
16700+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211",
1670316701
getLaneLabelMap: function () {
1670416702
for (
1670516703
var map = new Map(), lane = 1, index$294 = 0;
@@ -16818,4 +16816,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1681816816
listenToAllSupportedEvents(container);
1681916817
return new ReactDOMHydrationRoot(initialChildren);
1682016818
};
16821-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
16819+
exports.version = "19.1.0-native-fb-899e3d12-20250211";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7d766414b273732e4a3a24f84100791e>>
10+
* @generated SignedSource<<781f3f60512393dfda17b4a9f04cb5ae>>
1111
*/
1212

1313
/*
@@ -11236,11 +11236,7 @@ __DEV__ &&
1123611236
lastEffect = finishedWork;
1123711237
var nearestMountedAncestor =
1123811238
nearestMountedAncestor$jscomp$0,
11239-
resource = updateQueue.inst.resource,
11240-
destroy_ =
11241-
null == resource
11242-
? destroy
11243-
: destroy.bind(null, resource);
11239+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
1124411240
runWithFiberInDEV(
1124511241
lastEffect,
1124611242
callDestroyInDEV,
@@ -26100,11 +26096,11 @@ __DEV__ &&
2610026096
};
2610126097
(function () {
2610226098
var isomorphicReactPackageVersion = React.version;
26103-
if ("19.1.0-native-fb-cd90a4d8-20250210" !== isomorphicReactPackageVersion)
26099+
if ("19.1.0-native-fb-899e3d12-20250211" !== isomorphicReactPackageVersion)
2610426100
throw Error(
2610526101
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2610626102
(isomorphicReactPackageVersion +
26107-
"\n - react-dom: 19.1.0-native-fb-cd90a4d8-20250210\nLearn more: https://react.dev/warnings/version-mismatch")
26103+
"\n - react-dom: 19.1.0-native-fb-899e3d12-20250211\nLearn more: https://react.dev/warnings/version-mismatch")
2610826104
);
2610926105
})();
2611026106
("function" === typeof Map &&
@@ -26141,10 +26137,10 @@ __DEV__ &&
2614126137
!(function () {
2614226138
var internals = {
2614326139
bundleType: 1,
26144-
version: "19.1.0-native-fb-cd90a4d8-20250210",
26140+
version: "19.1.0-native-fb-899e3d12-20250211",
2614526141
rendererPackageName: "react-dom",
2614626142
currentDispatcherRef: ReactSharedInternals,
26147-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210"
26143+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211"
2614826144
};
2614926145
internals.overrideHookState = overrideHookState;
2615026146
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26604,7 +26600,7 @@ __DEV__ &&
2660426600
exports.useFormStatus = function () {
2660526601
return resolveDispatcher().useHostTransitionStatus();
2660626602
};
26607-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
26603+
exports.version = "19.1.0-native-fb-899e3d12-20250211";
2660826604
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2660926605
"function" ===
2661026606
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4d6413e9020c1a88850d554159892060>>
10+
* @generated SignedSource<<9040b9d5240817444d50f94bed608ad1>>
1111
*/
1212

1313
/*
@@ -7821,9 +7821,7 @@ function commitHookEffectListUnmount(
78217821
) {
78227822
lastEffect = finishedWork;
78237823
var nearestMountedAncestor = nearestMountedAncestor$jscomp$0,
7824-
resource = updateQueue.inst.resource,
7825-
destroy_ =
7826-
null == resource ? destroy : destroy.bind(null, resource);
7824+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
78277825
try {
78287826
destroy_();
78297827
} catch (error) {
@@ -16029,14 +16027,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1602916027
};
1603016028
var isomorphicReactPackageVersion$jscomp$inline_1803 = React.version;
1603116029
if (
16032-
"19.1.0-native-fb-cd90a4d8-20250210" !==
16030+
"19.1.0-native-fb-899e3d12-20250211" !==
1603316031
isomorphicReactPackageVersion$jscomp$inline_1803
1603416032
)
1603516033
throw Error(
1603616034
formatProdErrorMessage(
1603716035
527,
1603816036
isomorphicReactPackageVersion$jscomp$inline_1803,
16039-
"19.1.0-native-fb-cd90a4d8-20250210"
16037+
"19.1.0-native-fb-899e3d12-20250211"
1604016038
)
1604116039
);
1604216040
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16058,10 +16056,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1605816056
};
1605916057
var internals$jscomp$inline_2265 = {
1606016058
bundleType: 0,
16061-
version: "19.1.0-native-fb-cd90a4d8-20250210",
16059+
version: "19.1.0-native-fb-899e3d12-20250211",
1606216060
rendererPackageName: "react-dom",
1606316061
currentDispatcherRef: ReactSharedInternals,
16064-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210"
16062+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211"
1606516063
};
1606616064
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1606716065
var hook$jscomp$inline_2266 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16319,4 +16317,4 @@ exports.useFormState = function (action, initialState, permalink) {
1631916317
exports.useFormStatus = function () {
1632016318
return ReactSharedInternals.H.useHostTransitionStatus();
1632116319
};
16322-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
16320+
exports.version = "19.1.0-native-fb-899e3d12-20250211";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f6f287ef9aeeeabbf9a95100b67b9680>>
10+
* @generated SignedSource<<4ee6a26294e56139ad47dd9437f765f8>>
1111
*/
1212

1313
/*
@@ -8071,9 +8071,7 @@ function commitHookEffectListUnmount(
80718071
) {
80728072
lastEffect = finishedWork;
80738073
var nearestMountedAncestor = nearestMountedAncestor$jscomp$0,
8074-
resource = updateQueue.inst.resource,
8075-
destroy_ =
8076-
null == resource ? destroy : destroy.bind(null, resource);
8074+
destroy_ = destroy.bind(null, updateQueue.inst.resource);
80778075
try {
80788076
destroy_();
80798077
} catch (error) {
@@ -16682,14 +16680,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1668216680
};
1668316681
var isomorphicReactPackageVersion$jscomp$inline_1898 = React.version;
1668416682
if (
16685-
"19.1.0-native-fb-cd90a4d8-20250210" !==
16683+
"19.1.0-native-fb-899e3d12-20250211" !==
1668616684
isomorphicReactPackageVersion$jscomp$inline_1898
1668716685
)
1668816686
throw Error(
1668916687
formatProdErrorMessage(
1669016688
527,
1669116689
isomorphicReactPackageVersion$jscomp$inline_1898,
16692-
"19.1.0-native-fb-cd90a4d8-20250210"
16690+
"19.1.0-native-fb-899e3d12-20250211"
1669316691
)
1669416692
);
1669516693
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16711,10 +16709,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1671116709
};
1671216710
var internals$jscomp$inline_1905 = {
1671316711
bundleType: 0,
16714-
version: "19.1.0-native-fb-cd90a4d8-20250210",
16712+
version: "19.1.0-native-fb-899e3d12-20250211",
1671516713
rendererPackageName: "react-dom",
1671616714
currentDispatcherRef: ReactSharedInternals,
16717-
reconcilerVersion: "19.1.0-native-fb-cd90a4d8-20250210",
16715+
reconcilerVersion: "19.1.0-native-fb-899e3d12-20250211",
1671816716
getLaneLabelMap: function () {
1671916717
for (
1672016718
var map = new Map(), lane = 1, index$294 = 0;
@@ -16987,7 +16985,7 @@ exports.useFormState = function (action, initialState, permalink) {
1698716985
exports.useFormStatus = function () {
1698816986
return ReactSharedInternals.H.useHostTransitionStatus();
1698916987
};
16990-
exports.version = "19.1.0-native-fb-cd90a4d8-20250210";
16988+
exports.version = "19.1.0-native-fb-899e3d12-20250211";
1699116989
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1699216990
"function" ===
1699316991
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)