Skip to content

Commit de67894

Browse files
committed
Guard against inlined dispatcher calls
1 parent 274e1cc commit de67894

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,11 @@ function findPrimitiveIndex(hookStack: any, hook: HookLogEntry) {
882882
isReactWrapper(hookStack[i].functionName, hook.dispatcherHookName)
883883
) {
884884
i++;
885-
i++;
885+
// Guard against the dispatcher call being inlined.
886+
// At this point we wouldn't be able to recover the actual React Hook name.
887+
if (i < hookStack.length - 1) {
888+
i++;
889+
}
886890
}
887891
return i;
888892
}

0 commit comments

Comments
 (0)