DevTools: guard against undefined component stack in Profiler SidebarEventInfo#35054
DevTools: guard against undefined component stack in Profiler SidebarEventInfo#35054Abhra0404 wants to merge 1 commit intofacebook:mainfrom
Conversation
…o.js; remove type annotations for JS compatibility. Fixes facebook#35049
|
Hi @Abhra0404! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
| </div> | ||
| <ul className={styles.List}> | ||
| {stackToComponentLocations(componentStack).map( | ||
| {(stackToComponentLocations(componentStack) || []).map( |
There was a problem hiding this comment.
stackToComponentLocations always returns an array
|
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
|
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
Fixes a crash in the DevTools Profiler where calling
.mapon an undefined component stack could throw: "Cannot read properties of undefined (reading 'map')". See issue #35049.What I changed:
stackToComponentLocations(componentStack)is treated as an array before calling.mapinpackages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.js.SidebarEventInfo.jsto keep the file valid JavaScript in this build.Why:
componentStackwas undefined (e.g. during navigation in React Native), the code attempted to call.mapon the result, causing the Profiler to crash. Guarding the.mapcall prevents the crash.Notes / Testing:
fix/profiler-crash-35049in my fork (Abhra0404/react).This PR references and aims to address #35049.