[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.
This commit is contained in:
Ruslan Lesiutin 2025-07-04 10:32:09 +01:00 committed by GitHub
parent ef8b6fa257
commit 3fc1bc6f28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -360,8 +360,9 @@ function collectStackTrace(
const callSite = structuredStackTrace[i];
const name = callSite.getFunctionName();
if (
name.includes('react_stack_bottom_frame') ||
name.includes('react-stack-bottom-frame')
name != null &&
(name.includes('react_stack_bottom_frame') ||
name.includes('react-stack-bottom-frame'))
) {
// We pick the last frame that matches before the bottom frame since
// that will be immediately inside the component as opposed to some helper.