Skip to content

Commit 15d22ad

Browse files
committed
Print constructor name
1 parent 8de9450 commit 15d22ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-client/src/ReactFlightPerformanceTrack.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function addValueToProperties(
9696
} else {
9797
// $FlowFixMe[method-unbinding]
9898
const objectToString = Object.prototype.toString.call(value);
99-
const objectName = objectToString.slice(8, objectToString.length - 1);
99+
let objectName = objectToString.slice(8, objectToString.length - 1);
100100
if (objectName === 'Array') {
101101
const array: Array<any> = (value: any);
102102
const kind = getArrayKind(array);
@@ -112,6 +112,12 @@ function addValueToProperties(
112112
return;
113113
}
114114
}
115+
if (objectName === 'Object') {
116+
const proto: any = Object.getPrototypeOf(value);
117+
if (proto && typeof proto.constructor === 'function') {
118+
objectName = proto.constructor.name;
119+
}
120+
}
115121
properties.push([
116122
'\xa0\xa0'.repeat(indent) + propertyName,
117123
objectName === 'Object' ? '' : objectName,

0 commit comments

Comments
 (0)