[devtools] fix: support optionality of structured stack trace function name (#33697)
Follow-up to https://github.com/facebook/react/pull/33680. Turns out `.getFunctionName` not always returns string.
Ruslan Lesiutin committed
Jul 4, 2025 at 10:32 UTC
3fc1bc6f28bec1742b5f07d23148f25927e21d41
1 file changed
+3
-2
packages/react-devtools-shared/src/backend/utils/index.js
+3
-2
@@ -360,8 +360,9 @@ function collectStackTrace(
360
const callSite = structuredStackTrace[i];
361
const name = callSite.getFunctionName();
362
if (
363
- name.includes('react_stack_bottom_frame') ||
364
- name.includes('react-stack-bottom-frame')
363
+ name != null &&
364
+ (name.includes('react_stack_bottom_frame') ||
365
+ name.includes('react-stack-bottom-frame'))
366
) {
367
// We pick the last frame that matches before the bottom frame since
368
// that will be immediately inside the component as opposed to some helper.