Skip to content

Commit a6b6ccf

Browse files
committed
Allow returning a temporary reference inside an async function (#33761)
<!-- 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 Fixes `await`-ing and returning temporary references in `async` functions. These two operations invoke `.then()` under the hood if it is available, which currently results in an "Cannot access then on the server. You cannot dot into a temporary client reference..." error. This can easily be reproduced by returning a temporary reference from a server function. Fixes #33534 ## How did you test this change? I added a test in a new test file. I wasn't sure where else to put it. <img width="771" height="138" alt="image" src="https://github.com/user-attachments/assets/09ffe6eb-271a-4842-a9fe-c68e17b3fb41" /> <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. How exactly did you verify that your PR solves the issue you wanted to solve? If you leave this empty, your PR will very likely be closed. --> DiffTrain build for [1d16396](1d16396)
1 parent 789bae0 commit a6b6ccf

26 files changed

+121
-101
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.2.0-native-fb-0860b9cc-20250801
1+
19.2.0-native-fb-1d163962-20250802

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<<aa187066c30394a3c15629e5abdf9c4e>>
10+
* @generated SignedSource<<8ae4fd7266b163aea9892d5ca4037ecd>>
1111
*/
1212

1313
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
404404
exports.useFormStatus = function () {
405405
return resolveDispatcher().useHostTransitionStatus();
406406
};
407-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
407+
exports.version = "19.2.0-native-fb-1d163962-20250802";
408408
})();

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<<1acfed59bbd6b544d14b343d95fa59f6>>
10+
* @generated SignedSource<<b7245c6e68c0a382c27e3cf90423c993>>
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.2.0-native-fb-0860b9cc-20250801";
206+
exports.version = "19.2.0-native-fb-1d163962-20250802";

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<<1acfed59bbd6b544d14b343d95fa59f6>>
10+
* @generated SignedSource<<b7245c6e68c0a382c27e3cf90423c993>>
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.2.0-native-fb-0860b9cc-20250801";
206+
exports.version = "19.2.0-native-fb-1d163962-20250802";

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

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

1313
/*
@@ -29025,11 +29025,11 @@ __DEV__ &&
2902529025
};
2902629026
(function () {
2902729027
var isomorphicReactPackageVersion = React.version;
29028-
if ("19.2.0-native-fb-0860b9cc-20250801" !== isomorphicReactPackageVersion)
29028+
if ("19.2.0-native-fb-1d163962-20250802" !== isomorphicReactPackageVersion)
2902929029
throw Error(
2903029030
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2903129031
(isomorphicReactPackageVersion +
29032-
"\n - react-dom: 19.2.0-native-fb-0860b9cc-20250801\nLearn more: https://react.dev/warnings/version-mismatch")
29032+
"\n - react-dom: 19.2.0-native-fb-1d163962-20250802\nLearn more: https://react.dev/warnings/version-mismatch")
2903329033
);
2903429034
})();
2903529035
("function" === typeof Map &&
@@ -29066,10 +29066,10 @@ __DEV__ &&
2906629066
!(function () {
2906729067
var internals = {
2906829068
bundleType: 1,
29069-
version: "19.2.0-native-fb-0860b9cc-20250801",
29069+
version: "19.2.0-native-fb-1d163962-20250802",
2907029070
rendererPackageName: "react-dom",
2907129071
currentDispatcherRef: ReactSharedInternals,
29072-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801"
29072+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802"
2907329073
};
2907429074
internals.overrideHookState = overrideHookState;
2907529075
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29207,5 +29207,5 @@ __DEV__ &&
2920729207
listenToAllSupportedEvents(container);
2920829208
return new ReactDOMHydrationRoot(initialChildren);
2920929209
};
29210-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
29210+
exports.version = "19.2.0-native-fb-1d163962-20250802";
2921129211
})();

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

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

1313
/*
@@ -17128,14 +17128,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1712817128
};
1712917129
var isomorphicReactPackageVersion$jscomp$inline_2002 = React.version;
1713017130
if (
17131-
"19.2.0-native-fb-0860b9cc-20250801" !==
17131+
"19.2.0-native-fb-1d163962-20250802" !==
1713217132
isomorphicReactPackageVersion$jscomp$inline_2002
1713317133
)
1713417134
throw Error(
1713517135
formatProdErrorMessage(
1713617136
527,
1713717137
isomorphicReactPackageVersion$jscomp$inline_2002,
17138-
"19.2.0-native-fb-0860b9cc-20250801"
17138+
"19.2.0-native-fb-1d163962-20250802"
1713917139
)
1714017140
);
1714117141
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17157,10 +17157,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1715717157
};
1715817158
var internals$jscomp$inline_2521 = {
1715917159
bundleType: 0,
17160-
version: "19.2.0-native-fb-0860b9cc-20250801",
17160+
version: "19.2.0-native-fb-1d163962-20250802",
1716117161
rendererPackageName: "react-dom",
1716217162
currentDispatcherRef: ReactSharedInternals,
17163-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801"
17163+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802"
1716417164
};
1716517165
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1716617166
var hook$jscomp$inline_2522 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17258,4 +17258,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1725817258
listenToAllSupportedEvents(container);
1725917259
return new ReactDOMHydrationRoot(initialChildren);
1726017260
};
17261-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
17261+
exports.version = "19.2.0-native-fb-1d163962-20250802";

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

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

1313
/*
@@ -19086,14 +19086,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1908619086
};
1908719087
var isomorphicReactPackageVersion$jscomp$inline_2242 = React.version;
1908819088
if (
19089-
"19.2.0-native-fb-0860b9cc-20250801" !==
19089+
"19.2.0-native-fb-1d163962-20250802" !==
1909019090
isomorphicReactPackageVersion$jscomp$inline_2242
1909119091
)
1909219092
throw Error(
1909319093
formatProdErrorMessage(
1909419094
527,
1909519095
isomorphicReactPackageVersion$jscomp$inline_2242,
19096-
"19.2.0-native-fb-0860b9cc-20250801"
19096+
"19.2.0-native-fb-1d163962-20250802"
1909719097
)
1909819098
);
1909919099
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19115,10 +19115,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1911519115
};
1911619116
var internals$jscomp$inline_2249 = {
1911719117
bundleType: 0,
19118-
version: "19.2.0-native-fb-0860b9cc-20250801",
19118+
version: "19.2.0-native-fb-1d163962-20250802",
1911919119
rendererPackageName: "react-dom",
1912019120
currentDispatcherRef: ReactSharedInternals,
19121-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801",
19121+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802",
1912219122
getLaneLabelMap: function () {
1912319123
for (
1912419124
var map = new Map(), lane = 1, index$319 = 0;
@@ -19231,4 +19231,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1923119231
listenToAllSupportedEvents(container);
1923219232
return new ReactDOMHydrationRoot(initialChildren);
1923319233
};
19234-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
19234+
exports.version = "19.2.0-native-fb-1d163962-20250802";

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

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

1313
/*
@@ -29081,11 +29081,11 @@ __DEV__ &&
2908129081
};
2908229082
(function () {
2908329083
var isomorphicReactPackageVersion = React.version;
29084-
if ("19.2.0-native-fb-0860b9cc-20250801" !== isomorphicReactPackageVersion)
29084+
if ("19.2.0-native-fb-1d163962-20250802" !== isomorphicReactPackageVersion)
2908529085
throw Error(
2908629086
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2908729087
(isomorphicReactPackageVersion +
29088-
"\n - react-dom: 19.2.0-native-fb-0860b9cc-20250801\nLearn more: https://react.dev/warnings/version-mismatch")
29088+
"\n - react-dom: 19.2.0-native-fb-1d163962-20250802\nLearn more: https://react.dev/warnings/version-mismatch")
2908929089
);
2909029090
})();
2909129091
("function" === typeof Map &&
@@ -29122,10 +29122,10 @@ __DEV__ &&
2912229122
!(function () {
2912329123
var internals = {
2912429124
bundleType: 1,
29125-
version: "19.2.0-native-fb-0860b9cc-20250801",
29125+
version: "19.2.0-native-fb-1d163962-20250802",
2912629126
rendererPackageName: "react-dom",
2912729127
currentDispatcherRef: ReactSharedInternals,
29128-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801"
29128+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802"
2912929129
};
2913029130
internals.overrideHookState = overrideHookState;
2913129131
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29579,7 +29579,7 @@ __DEV__ &&
2957929579
exports.useFormStatus = function () {
2958029580
return resolveDispatcher().useHostTransitionStatus();
2958129581
};
29582-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
29582+
exports.version = "19.2.0-native-fb-1d163962-20250802";
2958329583
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2958429584
"function" ===
2958529585
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

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

1313
/*
@@ -17139,14 +17139,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1713917139
};
1714017140
var isomorphicReactPackageVersion$jscomp$inline_2003 = React.version;
1714117141
if (
17142-
"19.2.0-native-fb-0860b9cc-20250801" !==
17142+
"19.2.0-native-fb-1d163962-20250802" !==
1714317143
isomorphicReactPackageVersion$jscomp$inline_2003
1714417144
)
1714517145
throw Error(
1714617146
formatProdErrorMessage(
1714717147
527,
1714817148
isomorphicReactPackageVersion$jscomp$inline_2003,
17149-
"19.2.0-native-fb-0860b9cc-20250801"
17149+
"19.2.0-native-fb-1d163962-20250802"
1715017150
)
1715117151
);
1715217152
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17168,10 +17168,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1716817168
};
1716917169
var internals$jscomp$inline_2524 = {
1717017170
bundleType: 0,
17171-
version: "19.2.0-native-fb-0860b9cc-20250801",
17171+
version: "19.2.0-native-fb-1d163962-20250802",
1717217172
rendererPackageName: "react-dom",
1717317173
currentDispatcherRef: ReactSharedInternals,
17174-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801"
17174+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802"
1717517175
};
1717617176
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1717717177
var hook$jscomp$inline_2525 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17422,4 +17422,4 @@ exports.useFormState = function (action, initialState, permalink) {
1742217422
exports.useFormStatus = function () {
1742317423
return ReactSharedInternals.H.useHostTransitionStatus();
1742417424
};
17425-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
17425+
exports.version = "19.2.0-native-fb-1d163962-20250802";

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<84791f473f6a48bd038e28998b343334>>
10+
* @generated SignedSource<<39bb45866b742ac6c5a4aef0aaf2f38a>>
1111
*/
1212

1313
/*
@@ -19101,14 +19101,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1910119101
};
1910219102
var isomorphicReactPackageVersion$jscomp$inline_2243 = React.version;
1910319103
if (
19104-
"19.2.0-native-fb-0860b9cc-20250801" !==
19104+
"19.2.0-native-fb-1d163962-20250802" !==
1910519105
isomorphicReactPackageVersion$jscomp$inline_2243
1910619106
)
1910719107
throw Error(
1910819108
formatProdErrorMessage(
1910919109
527,
1911019110
isomorphicReactPackageVersion$jscomp$inline_2243,
19111-
"19.2.0-native-fb-0860b9cc-20250801"
19111+
"19.2.0-native-fb-1d163962-20250802"
1911219112
)
1911319113
);
1911419114
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19130,10 +19130,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1913019130
};
1913119131
var internals$jscomp$inline_2250 = {
1913219132
bundleType: 0,
19133-
version: "19.2.0-native-fb-0860b9cc-20250801",
19133+
version: "19.2.0-native-fb-1d163962-20250802",
1913419134
rendererPackageName: "react-dom",
1913519135
currentDispatcherRef: ReactSharedInternals,
19136-
reconcilerVersion: "19.2.0-native-fb-0860b9cc-20250801",
19136+
reconcilerVersion: "19.2.0-native-fb-1d163962-20250802",
1913719137
getLaneLabelMap: function () {
1913819138
for (
1913919139
var map = new Map(), lane = 1, index$319 = 0;
@@ -19399,7 +19399,7 @@ exports.useFormState = function (action, initialState, permalink) {
1939919399
exports.useFormStatus = function () {
1940019400
return ReactSharedInternals.H.useHostTransitionStatus();
1940119401
};
19402-
exports.version = "19.2.0-native-fb-0860b9cc-20250801";
19402+
exports.version = "19.2.0-native-fb-1d163962-20250802";
1940319403
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1940419404
"function" ===
1940519405
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)