@@ -1109,6 +1109,29 @@ export function inspectHooksOfFiber(
1109
1109
currentHook = (fiber.memoizedState: Hook);
1110
1110
currentFiber = fiber;
1111
1111
1112
+ if (hasOwnProperty.call(currentFiber, 'dependencies')) {
1113
+ // $FlowFixMe[incompatible-use]: Flow thinks hasOwnProperty might have nulled `currentFiber`
1114
+ const dependencies = currentFiber . dependencies ;
1115
+ currentContextDependency =
1116
+ dependencies !== null ? dependencies . firstContext : null ;
1117
+ } else if (hasOwnProperty.call(currentFiber, 'dependencies_old')) {
1118
+ const dependencies : Dependencies = ( currentFiber : any ) . dependencies_old ;
1119
+ currentContextDependency =
1120
+ dependencies !== null ? dependencies . firstContext : null ;
1121
+ } else if (hasOwnProperty.call(currentFiber, 'dependencies_new')) {
1122
+ const dependencies : Dependencies = ( currentFiber : any ) . dependencies_new ;
1123
+ currentContextDependency =
1124
+ dependencies !== null ? dependencies . firstContext : null ;
1125
+ } else if (hasOwnProperty.call(currentFiber, 'contextDependencies')) {
1126
+ const contextDependencies = ( currentFiber : any ) . contextDependencies ;
1127
+ currentContextDependency =
1128
+ contextDependencies !== null ? contextDependencies . first : null ;
1129
+ } else {
1130
+ throw new Error (
1131
+ 'Unsupported React version. This is a bug in React Debug Tools.' ,
1132
+ ) ;
1133
+ }
1134
+
1112
1135
const type = fiber.type;
1113
1136
let props = fiber.memoizedProps;
1114
1137
if (type !== fiber.elementType) {
@@ -1118,30 +1141,11 @@ export function inspectHooksOfFiber(
1118
1141
// Only used for versions of React without memoized context value in context dependencies.
1119
1142
const contextMap = new Map< ReactContext < any > , any> ( ) ;
1120
1143
try {
1121
- if ( hasOwnProperty . call ( currentFiber , 'dependencies' ) ) {
1122
- // $FlowFixMe[incompatible-use]: Flow thinks hasOwnProperty might have nulled `currentFiber`
1123
- const dependencies = currentFiber . dependencies ;
1124
- currentContextDependency =
1125
- dependencies !== null ? dependencies . firstContext : null ;
1126
- } else if (hasOwnProperty.call(currentFiber, 'dependencies_old')) {
1127
- const dependencies : Dependencies = ( currentFiber : any ) . dependencies_old ;
1128
- currentContextDependency =
1129
- dependencies !== null ? dependencies . firstContext : null ;
1130
- setupContexts ( contextMap , fiber ) ;
1131
- } else if (hasOwnProperty.call(currentFiber, 'dependencies_new')) {
1132
- const dependencies : Dependencies = ( currentFiber : any ) . dependencies_new ;
1133
- currentContextDependency =
1134
- dependencies !== null ? dependencies . firstContext : null ;
1135
- setupContexts ( contextMap , fiber ) ;
1136
- } else if (hasOwnProperty.call(currentFiber, 'contextDependencies')) {
1137
- const contextDependencies = ( currentFiber : any ) . contextDependencies ;
1138
- currentContextDependency =
1139
- contextDependencies !== null ? contextDependencies . first : null ;
1144
+ if (
1145
+ currentContextDependency !== null &&
1146
+ ! hasOwnProperty . call ( currentContextDependency , 'memoizedValue' )
1147
+ ) {
1140
1148
setupContexts ( contextMap , fiber ) ;
1141
- } else {
1142
- throw new Error (
1143
- 'Unsupported React version. This is a bug in React Debug Tools.' ,
1144
- ) ;
1145
1149
}
1146
1150
1147
1151
if (fiber.tag === ForwardRef) {
0 commit comments