Issue 1:
Website or app

https://codesandbox.io/s/react-devtools-weird-bug-o3sib?file=/src/App.js

Repro steps

I stumbled across the weirdest bug with React DevTools and hooks that causes it to error out when inspecting a component. A minimal test case is documented in the Code Sandbox link, along with more details on the behavior and seemingly-arbitrary fixes. This does not affect the actual functionality of the app itself in any way, it behaves exactly as expected.

How often does this bug happen?

Every time

DevTools package (automated)

react-devtools-extensions

DevTools version (automated)

4.21.0-2f8f60ca8

Error message (automated)

Cannot read properties of undefined (reading 'push')

Error call stack (automated)

at J (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:13006:7)
at L (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:13040:10)
at exports.inspectHooksOfFiber (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:13101:12)
at inspectElementRaw (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:7732:65)
at Object.inspectElement (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:8004:38)
at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:9837:56
at Bridge.emit (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:4257:18)
at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:10500:12
at listener (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/react_devtools_backend.js:11737:9)

Error component stack (automated)

at InspectedElementContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:38726:3)
at Suspense
at ErrorBoundary_ErrorBoundary (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37092:5)
at div
at InspectedElementErrorBoundaryWrapper (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37572:3)
at NativeStyleContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40146:3)
at div
at div
at OwnersListContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:35254:3)
at SettingsModalContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:35695:3)
at Components_Components (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:42085:52)
at ErrorBoundary_ErrorBoundary (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37092:5)
at div
at div
at ThemeProvider (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37222:3)
at PortaledContent (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37256:5)
at div
at div
at div
at ThemeProvider (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37222:3)
at SchedulingProfilerContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:43423:3)
at ProfilerContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:41711:3)
at TreeContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30116:3)
at SettingsContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30727:3)
at ModalDialogContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37635:3)
at DevTools_DevTools (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:53004:3)

GitHub query string (automated)

https://api.github.com/search/issues?q=Cannot read properties of undefined (reading 'push') in:title is:issue is:open is:public label:"Component: Developer Tools" repo:facebook/react

Issue 2:
React version: 17.0.1

Steps To Reproduce

clone repo: https://github.com/avkonst/react-devtools-crash-demo

yarn start

open the browser of the started app

open devtools

click Counter component in the components tab of the development tools

Watch it not loading anything and unhandled exception dumped to the console log

Link to code example: https://github.com/avkonst/react-devtools-crash-demo

The current behavior

Devtools crash when I click on the following component in the development tools:

import React from 'react';

function useState() {
React.useState(0);
React.useEffect(() => () => {});
}

function Counter() {
useState();
React.useState(0);
return <div>Open React Dev Tools Components panel,
click on Counter component and
observe the crash in the logging console.</div>;
}

export default Counter;

The expected behavior

No crash and the development tools show hooks used.