Description
We noticed that our app would behave differently during profiling runs and trigger errors. I'm not totally sure what the underlying issue is but I was able to put together a example app to reproduce. As far as I can tell it has to do with how devtools is overriding console.warn
and console.error
. In that case describeNativeComponentFrame()
will call a function component with no args. This works fine as the error is caught in describeNativeComponentFrame()
but in it looks like a useEffect()
that accesses those props
is still triggered and it does not expect props
to be undefined.
I realize that having props
in the dependencies array of the useEffect
doesn't really make sense but I still think it probably shouldn't error.
React version: 16.13.1
React devtools version: 4.8.2
Steps To Reproduce
- Open link to code example below
- Click "Open In New Window" from the "Browser" tab
- Observe a simple app with only
<h1>Hello World</h1>
- Open the React devtools Profiler tab
- Click "Reload and start profiling"
- Observe an error
Uncaught TypeError: Cannot read property 'foo' of undefined
Link to code example:
https://codesandbox.io/s/cool-sun-wdrry
The current behavior
The expected behavior
The app should work as it while not profile. It should render a <h1>Hello World</h1>