Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update packages/react-debug-tools/src/ReactDebugHooks.js
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
  • Loading branch information
bl00mber and bvaughn authored Sep 4, 2020
commit 3b5d73904b47551c408833f0885f375d39ae05ab
14 changes: 8 additions & 6 deletions packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,12 +707,14 @@ export function inspectHooksOfFiber(
const contextMap = new Map();
try {
if (fiber.tag === FunctionComponent) {
const legacyContext = setupContexts(
contextMap,
fiber,
enableLegacyContext,
);
return inspectHooks(type, props, currentDispatcher, legacyContext);
const hasLegacyContext = !!fiber.elementType.contextTypes;
if (hasLegacyContext) {
const legacyContext = getLegacyContext(fiber);
return inspectHooks(type, props, currentDispatcher, legacyContext);
} else {
setupContext(contextMap, fiber);
return inspectHooks(type, props, currentDispatcher);
}
} else if (fiber.tag === ForwardRef) {
setupContexts(contextMap, fiber);
return inspectHooksOfForwardRef(
Expand Down