Skip to content

Commit da64117

Browse files
authored
[Perf Tracks] Handle function names that aren't strings (#35659)
1 parent 230772f commit da64117

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/shared/ReactPerformanceTrackProperties.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,15 @@ export function addValueToProperties(
253253
return;
254254
}
255255
case 'function':
256-
if (value.name === '') {
256+
const functionName = value.name;
257+
if (
258+
functionName === '' ||
259+
// e.g. proxied functions or classes with a static property "name" that's not a string
260+
typeof functionName !== 'string'
261+
) {
257262
desc = '() => {}';
258263
} else {
259-
desc = value.name + '() {}';
264+
desc = functionName + '() {}';
260265
}
261266
break;
262267
case 'string':

0 commit comments

Comments
 (0)