Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/shared/ReactPerformanceTrackProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export function addObjectToProperties(
}
}

function readTypeof(value: any): any {
try {
return value.$$typeof;
} catch (error) {
return undefined;
}
}

export function addValueToProperties(
propertyName: string,
value: mixed,
Expand All @@ -94,7 +102,7 @@ export function addValueToProperties(
desc = 'null';
break;
} else {
if (value.$$typeof === REACT_ELEMENT_TYPE) {
if (readTypeof(value) === REACT_ELEMENT_TYPE) {
// JSX
const typeName = getComponentNameFromType(value.type) || '\u2026';
const key = value.key;
Expand Down Expand Up @@ -345,9 +353,9 @@ export function addObjectDiffToProperties(
typeof nextValue === 'object' &&
prevValue !== null &&
nextValue !== null &&
prevValue.$$typeof === nextValue.$$typeof
readTypeof(prevValue) === readTypeof(nextValue)
) {
if (nextValue.$$typeof === REACT_ELEMENT_TYPE) {
if (readTypeof(nextValue) === REACT_ELEMENT_TYPE) {
if (
prevValue.type === nextValue.type &&
prevValue.key === nextValue.key
Expand Down