Skip to content

Commit

Permalink
useId: Remove unnecessary try/finally blocks (#27340)
Browse files Browse the repository at this point in the history
To generate IDs for useId, we modify a context variable whenever
multiple siblings are rendered, or when a component includes a useId
hook.

When this happens, we must ensure that the context is reset properly on
unwind if something errors or suspends. When I originally implemented
this, I did this by wrapping the child's rendering with a try/finally
block. But a better way to do this is by using the non-destructive
renderNode path instead of renderNodeDestructive.

DiffTrain build for commit ee7f9c9.
  • Loading branch information
acdlite committed Sep 6, 2023
1 parent 23d1b68 commit 91e2f1b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23994,7 +23994,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-b9be4537c-20230905";
var ReactVersion = "18.3.0-canary-ee7f9c935-20230906";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8617,7 +8617,7 @@ var devToolsConfig$jscomp$inline_1027 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-b9be4537c-20230905",
version: "18.3.0-canary-ee7f9c935-20230906",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1226 = {
Expand Down Expand Up @@ -8648,7 +8648,7 @@ var internals$jscomp$inline_1226 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-b9be4537c-20230905"
reconcilerVersion: "18.3.0-canary-ee7f9c935-20230906"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9043,7 +9043,7 @@ var devToolsConfig$jscomp$inline_1069 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-b9be4537c-20230905",
version: "18.3.0-canary-ee7f9c935-20230906",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1267 = {
Expand Down Expand Up @@ -9074,7 +9074,7 @@ var internals$jscomp$inline_1267 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-b9be4537c-20230905"
reconcilerVersion: "18.3.0-canary-ee7f9c935-20230906"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-b9be4537c-20230905";
var ReactVersion = "18.3.0-canary-ee7f9c935-20230906";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-b9be4537c-20230905";
exports.version = "18.3.0-canary-ee7f9c935-20230906";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-b9be4537c-20230905";
exports.version = "18.3.0-canary-ee7f9c935-20230906";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b9be4537c2459f8fc0312b796570003620bc8600
ee7f9c9351f8902e07ceacf4234ef75e7e4ecd73

0 comments on commit 91e2f1b

Please sign in to comment.