Skip to content

Commit

Permalink
[Fiber] Remove the digest property from errorInfo passed to onRecover…
Browse files Browse the repository at this point in the history
…ableError (#28222)

Removes the digest property from errorInfo passed to onRecoverableError
when handling an error propagated from the server. Previously we warned
in Dev but still provided the digest on the errorInfo object. This
change removes digest from error info but continues to warn if it is
accessed. The reason for retaining the warning is the version with the
warning was not released as stable but we will include this deprecated
removal in our next major so we should communicate this change at
runtime.

DiffTrain build for [299a9c0](299a9c0)
  • Loading branch information
gnoff committed Mar 28, 2024
1 parent dec75c4 commit 2d8f86f
Show file tree
Hide file tree
Showing 18 changed files with 436 additions and 412 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e10a7b5cd541882a78ff659147c1a0294413ccb0
299a9c0598576f7dba170771b1c0b821281b1e15
44 changes: 25 additions & 19 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "19.0.0-www-classic-4c84ebb8";
var ReactVersion = "19.0.0-www-classic-407418be";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -28294,10 +28294,7 @@ if (__DEV__) {

for (var i = 0; i < recoverableErrors.length; i++) {
var recoverableError = recoverableErrors[i];
var errorInfo = makeErrorInfo(
recoverableError.digest,
recoverableError.stack
);
var errorInfo = makeErrorInfo(recoverableError.stack);
onRecoverableError(recoverableError.value, errorInfo);
}
} // If the passive effects are the result of a discrete render, flush them
Expand Down Expand Up @@ -28360,26 +28357,35 @@ if (__DEV__) {
return null;
}

function makeErrorInfo(digest, componentStack) {
function makeErrorInfo(componentStack) {
{
var errorInfo = {
componentStack: componentStack,
digest: digest
componentStack: componentStack
};
Object.defineProperty(errorInfo, "digest", {
configurable: false,
enumerable: true,
get: function () {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is deprecated and will be removed in a future version of React." +
" To access the digest of an Error look for this property on the Error instance itself."
);
return new Proxy(errorInfo, {
get: function (target, prop, receiver) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return Reflect.get(target, prop, receiver);
},
has: function (target, prop) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return digest;
return Reflect.has(target, prop);
}
});
return errorInfo;
}
}

Expand Down
44 changes: 25 additions & 19 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "19.0.0-www-modern-c7273448";
var ReactVersion = "19.0.0-www-modern-e9fd3a91";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -27944,10 +27944,7 @@ if (__DEV__) {

for (var i = 0; i < recoverableErrors.length; i++) {
var recoverableError = recoverableErrors[i];
var errorInfo = makeErrorInfo(
recoverableError.digest,
recoverableError.stack
);
var errorInfo = makeErrorInfo(recoverableError.stack);
onRecoverableError(recoverableError.value, errorInfo);
}
} // If the passive effects are the result of a discrete render, flush them
Expand Down Expand Up @@ -28010,26 +28007,35 @@ if (__DEV__) {
return null;
}

function makeErrorInfo(digest, componentStack) {
function makeErrorInfo(componentStack) {
{
var errorInfo = {
componentStack: componentStack,
digest: digest
componentStack: componentStack
};
Object.defineProperty(errorInfo, "digest", {
configurable: false,
enumerable: true,
get: function () {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is deprecated and will be removed in a future version of React." +
" To access the digest of an Error look for this property on the Error instance itself."
);
return new Proxy(errorInfo, {
get: function (target, prop, receiver) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return Reflect.get(target, prop, receiver);
},
has: function (target, prop) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return digest;
return Reflect.has(target, prop);
}
});
return errorInfo;
}
}

Expand Down
35 changes: 16 additions & 19 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9854,10 +9854,7 @@ function commitRootImpl(
finishedWork++
)
(remainingLanes = recoverableErrors[finishedWork]),
(transitions = {
digest: remainingLanes.digest,
componentStack: remainingLanes.stack
}),
(transitions = { componentStack: remainingLanes.stack }),
renderPriorityLevel(remainingLanes.value, transitions);
0 !== (pendingPassiveEffectsLanes & 3) &&
0 !== root.tag &&
Expand Down Expand Up @@ -10611,19 +10608,19 @@ var slice = Array.prototype.slice,
};
return Text;
})(React.Component),
devToolsConfig$jscomp$inline_1120 = {
devToolsConfig$jscomp$inline_1119 = {
findFiberByHostInstance: function () {
return null;
},
bundleType: 0,
version: "19.0.0-www-classic-91b37899",
version: "19.0.0-www-classic-bfe909d0",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1325 = {
bundleType: devToolsConfig$jscomp$inline_1120.bundleType,
version: devToolsConfig$jscomp$inline_1120.version,
rendererPackageName: devToolsConfig$jscomp$inline_1120.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1120.rendererConfig,
var internals$jscomp$inline_1324 = {
bundleType: devToolsConfig$jscomp$inline_1119.bundleType,
version: devToolsConfig$jscomp$inline_1119.version,
rendererPackageName: devToolsConfig$jscomp$inline_1119.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1119.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -10640,26 +10637,26 @@ var internals$jscomp$inline_1325 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1120.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1119.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-91b37899"
reconcilerVersion: "19.0.0-www-classic-bfe909d0"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1326 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1326.isDisabled &&
hook$jscomp$inline_1326.supportsFiber
!hook$jscomp$inline_1325.isDisabled &&
hook$jscomp$inline_1325.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1326.inject(
internals$jscomp$inline_1325
(rendererID = hook$jscomp$inline_1325.inject(
internals$jscomp$inline_1324
)),
(injectedHook = hook$jscomp$inline_1326);
(injectedHook = hook$jscomp$inline_1325);
} catch (err) {}
}
var Path = Mode$1.Path;
Expand Down
35 changes: 16 additions & 19 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9549,10 +9549,7 @@ function commitRootImpl(
finishedWork++
)
(remainingLanes = recoverableErrors[finishedWork]),
(transitions = {
digest: remainingLanes.digest,
componentStack: remainingLanes.stack
}),
(transitions = { componentStack: remainingLanes.stack }),
renderPriorityLevel(remainingLanes.value, transitions);
0 !== (pendingPassiveEffectsLanes & 3) &&
0 !== root.tag &&
Expand Down Expand Up @@ -10266,19 +10263,19 @@ var slice = Array.prototype.slice,
};
return Text;
})(React.Component),
devToolsConfig$jscomp$inline_1100 = {
devToolsConfig$jscomp$inline_1099 = {
findFiberByHostInstance: function () {
return null;
},
bundleType: 0,
version: "19.0.0-www-modern-8e226e00",
version: "19.0.0-www-modern-c45bb981",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1305 = {
bundleType: devToolsConfig$jscomp$inline_1100.bundleType,
version: devToolsConfig$jscomp$inline_1100.version,
rendererPackageName: devToolsConfig$jscomp$inline_1100.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1100.rendererConfig,
var internals$jscomp$inline_1304 = {
bundleType: devToolsConfig$jscomp$inline_1099.bundleType,
version: devToolsConfig$jscomp$inline_1099.version,
rendererPackageName: devToolsConfig$jscomp$inline_1099.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1099.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -10295,26 +10292,26 @@ var internals$jscomp$inline_1305 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1100.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1099.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-8e226e00"
reconcilerVersion: "19.0.0-www-modern-c45bb981"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1306 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1305 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1306.isDisabled &&
hook$jscomp$inline_1306.supportsFiber
!hook$jscomp$inline_1305.isDisabled &&
hook$jscomp$inline_1305.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1306.inject(
internals$jscomp$inline_1305
(rendererID = hook$jscomp$inline_1305.inject(
internals$jscomp$inline_1304
)),
(injectedHook = hook$jscomp$inline_1306);
(injectedHook = hook$jscomp$inline_1305);
} catch (err) {}
}
var Path = Mode$1.Path;
Expand Down
44 changes: 25 additions & 19 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34001,10 +34001,7 @@ if (__DEV__) {

for (var i = 0; i < recoverableErrors.length; i++) {
var recoverableError = recoverableErrors[i];
var errorInfo = makeErrorInfo(
recoverableError.digest,
recoverableError.stack
);
var errorInfo = makeErrorInfo(recoverableError.stack);
onRecoverableError(recoverableError.value, errorInfo);
}
} // If the passive effects are the result of a discrete render, flush them
Expand Down Expand Up @@ -34100,26 +34097,35 @@ if (__DEV__) {
return null;
}

function makeErrorInfo(digest, componentStack) {
function makeErrorInfo(componentStack) {
{
var errorInfo = {
componentStack: componentStack,
digest: digest
componentStack: componentStack
};
Object.defineProperty(errorInfo, "digest", {
configurable: false,
enumerable: true,
get: function () {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is deprecated and will be removed in a future version of React." +
" To access the digest of an Error look for this property on the Error instance itself."
);
return new Proxy(errorInfo, {
get: function (target, prop, receiver) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return Reflect.get(target, prop, receiver);
},
has: function (target, prop) {
if (prop === "digest") {
error(
'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' +
" This property is no longer provided as part of errorInfo but can be accessed as a property" +
" of the Error instance itself."
);
}

return digest;
return Reflect.has(target, prop);
}
});
return errorInfo;
}
}

Expand Down Expand Up @@ -36339,7 +36345,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-classic-4154e20f";
var ReactVersion = "19.0.0-www-classic-623b131e";

function createPortal$1(
children,
Expand Down
Loading

0 comments on commit 2d8f86f

Please sign in to comment.