Skip to content

Commit b1ac5c1

Browse files
committed
Finish cleaning up digest from onRecoverableError (#28686)
Don't need to track it separately on the captured value anymore. Shouldn't be in the types. I used a getter for the warning instead because Proxies are kind of heavy weight options for this kind of warning. We typically use getters. DiffTrain build for [df95577](df95577)
1 parent 904602b commit b1ac5c1

17 files changed

+501
-653
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b9149cc6e6442389accf1f7c34a77ba2e6e52b5e
1+
df95577db0d1d7ca383f281bc1d9e6ba5579bef2

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-3ce339ba";
69+
var ReactVersion = "19.0.0-www-classic-9d9116a9";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -14567,20 +14567,18 @@ if (__DEV__) {
1456714567
return {
1456814568
value: value,
1456914569
source: source,
14570-
stack: stack,
14571-
digest: null
14570+
stack: stack
1457214571
};
1457314572
}
14574-
function createCapturedValueFromError(value, digest, stack) {
14573+
function createCapturedValueFromError(value, stack) {
1457514574
if (typeof stack === "string") {
1457614575
CapturedStacks.set(value, stack);
1457714576
}
1457814577

1457914578
return {
1458014579
value: value,
1458114580
source: null,
14582-
stack: stack != null ? stack : null,
14583-
digest: digest != null ? digest : null
14581+
stack: stack
1458414582
};
1458514583
}
1458614584

@@ -17563,7 +17561,9 @@ if (__DEV__) {
1756317561
// get an update and we'll never be able to hydrate the final content. Let's just try the
1756417562
// client side render instead.
1756517563
var digest;
17566-
var message, stack, componentStack;
17564+
var message;
17565+
var stack = null;
17566+
var componentStack = null;
1756717567

1756817568
{
1756917569
var _getSuspenseInstanceF =
@@ -17595,8 +17595,7 @@ if (__DEV__) {
1759517595
error.digest = digest;
1759617596
capturedValue = createCapturedValueFromError(
1759717597
error,
17598-
digest,
17599-
componentStack
17598+
componentStack === undefined ? null : componentStack
1760017599
);
1760117600
}
1760217601

@@ -17726,7 +17725,8 @@ if (__DEV__) {
1772617725
new Error(
1772717726
"There was an error while hydrating this Suspense boundary. " +
1772817727
"Switched to client rendering."
17729-
)
17728+
),
17729+
null
1773017730
);
1773117731

1773217732
return retrySuspenseComponentWithoutHydrating(
@@ -28387,35 +28387,23 @@ if (__DEV__) {
2838728387
}
2838828388

2838928389
function makeErrorInfo(componentStack) {
28390-
{
28391-
var errorInfo = {
28392-
componentStack: componentStack
28393-
};
28394-
return new Proxy(errorInfo, {
28395-
get: function (target, prop, receiver) {
28396-
if (prop === "digest") {
28397-
error(
28398-
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28399-
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28400-
" of the Error instance itself."
28401-
);
28402-
}
28403-
28404-
return Reflect.get(target, prop, receiver);
28405-
},
28406-
has: function (target, prop) {
28407-
if (prop === "digest") {
28408-
error(
28409-
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28410-
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28411-
" of the Error instance itself."
28412-
);
28413-
}
28390+
var errorInfo = {
28391+
componentStack: componentStack
28392+
};
2841428393

28415-
return Reflect.has(target, prop);
28394+
{
28395+
Object.defineProperty(errorInfo, "digest", {
28396+
get: function () {
28397+
error(
28398+
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28399+
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28400+
" of the Error instance itself."
28401+
);
2841628402
}
2841728403
});
2841828404
}
28405+
28406+
return errorInfo;
2841928407
}
2842028408

2842128409
function releaseRootPooledCache(root, remainingLanes) {

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-modern-78997ebd";
69+
var ReactVersion = "19.0.0-www-modern-89da8b81";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -14291,20 +14291,18 @@ if (__DEV__) {
1429114291
return {
1429214292
value: value,
1429314293
source: source,
14294-
stack: stack,
14295-
digest: null
14294+
stack: stack
1429614295
};
1429714296
}
14298-
function createCapturedValueFromError(value, digest, stack) {
14297+
function createCapturedValueFromError(value, stack) {
1429914298
if (typeof stack === "string") {
1430014299
CapturedStacks.set(value, stack);
1430114300
}
1430214301

1430314302
return {
1430414303
value: value,
1430514304
source: null,
14306-
stack: stack != null ? stack : null,
14307-
digest: digest != null ? digest : null
14305+
stack: stack
1430814306
};
1430914307
}
1431014308

@@ -17257,7 +17255,9 @@ if (__DEV__) {
1725717255
// get an update and we'll never be able to hydrate the final content. Let's just try the
1725817256
// client side render instead.
1725917257
var digest;
17260-
var message, stack, componentStack;
17258+
var message;
17259+
var stack = null;
17260+
var componentStack = null;
1726117261

1726217262
{
1726317263
var _getSuspenseInstanceF =
@@ -17289,8 +17289,7 @@ if (__DEV__) {
1728917289
error.digest = digest;
1729017290
capturedValue = createCapturedValueFromError(
1729117291
error,
17292-
digest,
17293-
componentStack
17292+
componentStack === undefined ? null : componentStack
1729417293
);
1729517294
}
1729617295

@@ -17420,7 +17419,8 @@ if (__DEV__) {
1742017419
new Error(
1742117420
"There was an error while hydrating this Suspense boundary. " +
1742217421
"Switched to client rendering."
17423-
)
17422+
),
17423+
null
1742417424
);
1742517425

1742617426
return retrySuspenseComponentWithoutHydrating(
@@ -28037,35 +28037,23 @@ if (__DEV__) {
2803728037
}
2803828038

2803928039
function makeErrorInfo(componentStack) {
28040-
{
28041-
var errorInfo = {
28042-
componentStack: componentStack
28043-
};
28044-
return new Proxy(errorInfo, {
28045-
get: function (target, prop, receiver) {
28046-
if (prop === "digest") {
28047-
error(
28048-
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28049-
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28050-
" of the Error instance itself."
28051-
);
28052-
}
28053-
28054-
return Reflect.get(target, prop, receiver);
28055-
},
28056-
has: function (target, prop) {
28057-
if (prop === "digest") {
28058-
error(
28059-
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28060-
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28061-
" of the Error instance itself."
28062-
);
28063-
}
28040+
var errorInfo = {
28041+
componentStack: componentStack
28042+
};
2806428043

28065-
return Reflect.has(target, prop);
28044+
{
28045+
Object.defineProperty(errorInfo, "digest", {
28046+
get: function () {
28047+
error(
28048+
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
28049+
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
28050+
" of the Error instance itself."
28051+
);
2806628052
}
2806728053
});
2806828054
}
28055+
28056+
return errorInfo;
2806928057
}
2807028058

2807128059
function releaseRootPooledCache(root, remainingLanes) {

compiled/facebook-www/ReactART-prod.classic.js

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,16 +3975,11 @@ function createCapturedValueAtFiber(value, source) {
39753975
((stack = getStackByFiberInDevAndProd(source)),
39763976
CapturedStacks.set(value, stack));
39773977
} else stack = getStackByFiberInDevAndProd(source);
3978-
return { value: value, source: source, stack: stack, digest: null };
3978+
return { value: value, source: source, stack: stack };
39793979
}
3980-
function createCapturedValueFromError(value, digest, stack) {
3980+
function createCapturedValueFromError(value, stack) {
39813981
"string" === typeof stack && CapturedStacks.set(value, stack);
3982-
return {
3983-
value: value,
3984-
source: null,
3985-
stack: null != stack ? stack : null,
3986-
digest: null != digest ? digest : null
3987-
};
3982+
return { value: value, source: null, stack: stack };
39883983
}
39893984
"function" === typeof reportError
39903985
? reportError
@@ -5017,7 +5012,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
50175012
? (pushPrimaryTreeSuspenseHandler(workInProgress),
50185013
(workInProgress.flags &= -257),
50195014
(JSCompiler_temp = createCapturedValueFromError(
5020-
Error(formatProdErrorMessage(422))
5015+
Error(formatProdErrorMessage(422)),
5016+
null
50215017
)),
50225018
(workInProgress = retrySuspenseComponentWithoutHydrating(
50235019
current,
@@ -5071,11 +5067,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
50715067
(nextProps = Error(formatProdErrorMessage(419))),
50725068
(nextProps.stack = ""),
50735069
(nextProps.digest = JSCompiler_temp),
5074-
(JSCompiler_temp = createCapturedValueFromError(
5075-
nextProps,
5076-
JSCompiler_temp,
5077-
void 0
5078-
)),
5070+
(JSCompiler_temp = createCapturedValueFromError(nextProps, null)),
50795071
(workInProgress = retrySuspenseComponentWithoutHydrating(
50805072
current,
50815073
workInProgress,
@@ -9858,8 +9850,9 @@ function commitRootImpl(
98589850
finishedWork++
98599851
)
98609852
(remainingLanes = recoverableErrors[finishedWork]),
9861-
(transitions = { componentStack: remainingLanes.stack }),
9862-
renderPriorityLevel(remainingLanes.value, transitions);
9853+
renderPriorityLevel(remainingLanes.value, {
9854+
componentStack: remainingLanes.stack
9855+
});
98639856
0 !== (pendingPassiveEffectsLanes & 3) &&
98649857
0 !== root.tag &&
98659858
flushPassiveEffects();
@@ -10612,19 +10605,19 @@ var slice = Array.prototype.slice,
1061210605
};
1061310606
return Text;
1061410607
})(React.Component),
10615-
devToolsConfig$jscomp$inline_1119 = {
10608+
devToolsConfig$jscomp$inline_1116 = {
1061610609
findFiberByHostInstance: function () {
1061710610
return null;
1061810611
},
1061910612
bundleType: 0,
10620-
version: "19.0.0-www-classic-859a948c",
10613+
version: "19.0.0-www-classic-5788b98f",
1062110614
rendererPackageName: "react-art"
1062210615
};
10623-
var internals$jscomp$inline_1324 = {
10624-
bundleType: devToolsConfig$jscomp$inline_1119.bundleType,
10625-
version: devToolsConfig$jscomp$inline_1119.version,
10626-
rendererPackageName: devToolsConfig$jscomp$inline_1119.rendererPackageName,
10627-
rendererConfig: devToolsConfig$jscomp$inline_1119.rendererConfig,
10616+
var internals$jscomp$inline_1321 = {
10617+
bundleType: devToolsConfig$jscomp$inline_1116.bundleType,
10618+
version: devToolsConfig$jscomp$inline_1116.version,
10619+
rendererPackageName: devToolsConfig$jscomp$inline_1116.rendererPackageName,
10620+
rendererConfig: devToolsConfig$jscomp$inline_1116.rendererConfig,
1062810621
overrideHookState: null,
1062910622
overrideHookStateDeletePath: null,
1063010623
overrideHookStateRenamePath: null,
@@ -10641,26 +10634,26 @@ var internals$jscomp$inline_1324 = {
1064110634
return null === fiber ? null : fiber.stateNode;
1064210635
},
1064310636
findFiberByHostInstance:
10644-
devToolsConfig$jscomp$inline_1119.findFiberByHostInstance ||
10637+
devToolsConfig$jscomp$inline_1116.findFiberByHostInstance ||
1064510638
emptyFindFiberByHostInstance,
1064610639
findHostInstancesForRefresh: null,
1064710640
scheduleRefresh: null,
1064810641
scheduleRoot: null,
1064910642
setRefreshHandler: null,
1065010643
getCurrentFiber: null,
10651-
reconcilerVersion: "19.0.0-www-classic-859a948c"
10644+
reconcilerVersion: "19.0.0-www-classic-5788b98f"
1065210645
};
1065310646
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
10654-
var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
10647+
var hook$jscomp$inline_1322 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1065510648
if (
10656-
!hook$jscomp$inline_1325.isDisabled &&
10657-
hook$jscomp$inline_1325.supportsFiber
10649+
!hook$jscomp$inline_1322.isDisabled &&
10650+
hook$jscomp$inline_1322.supportsFiber
1065810651
)
1065910652
try {
10660-
(rendererID = hook$jscomp$inline_1325.inject(
10661-
internals$jscomp$inline_1324
10653+
(rendererID = hook$jscomp$inline_1322.inject(
10654+
internals$jscomp$inline_1321
1066210655
)),
10663-
(injectedHook = hook$jscomp$inline_1325);
10656+
(injectedHook = hook$jscomp$inline_1322);
1066410657
} catch (err) {}
1066510658
}
1066610659
var Path = Mode$1.Path;

0 commit comments

Comments
 (0)