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
23 changes: 15 additions & 8 deletions packages/react-reconciler/src/ReactFiberPerformanceTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const reusableComponentOptions: PerformanceMeasureOptions = {
},
};

const resuableChangedPropsEntry = ['Changed Props', ''];
const reusableChangedPropsEntry = ['Changed Props', ''];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by typo fix


const DEEP_EQUALITY_WARNING =
'This component received deeply equal props. It might benefit from useMemo or the React Compiler in its owner.';
Expand Down Expand Up @@ -261,7 +261,7 @@ export function logComponentRender(
alternate.memoizedProps !== props
) {
// If this is an update, we'll diff the props and emit which ones changed.
const properties: Array<[string, string]> = [resuableChangedPropsEntry];
const properties: Array<[string, string]> = [reusableChangedPropsEntry];
const isDeeplyEqual = addObjectDiffToProperties(
alternate.memoizedProps,
props,
Expand Down Expand Up @@ -293,18 +293,20 @@ export function logComponentRender(
reusableComponentOptions.start = startTime;
reusableComponentOptions.end = endTime;

const measureName = '\u200b' + name;
if (debugTask != null) {
debugTask.run(
// $FlowFixMe[method-unbinding]
performance.measure.bind(
performance,
'\u200b' + name,
measureName,
reusableComponentOptions,
),
);
} else {
performance.measure('\u200b' + name, reusableComponentOptions);
performance.measure(measureName, reusableComponentOptions);
}
performance.clearMeasures(measureName);
}
} else {
if (debugTask != null) {
Expand Down Expand Up @@ -397,14 +399,17 @@ export function logComponentErrored(
},
},
};

const measureName = '\u200b' + name;
if (__DEV__ && debugTask) {
debugTask.run(
// $FlowFixMe[method-unbinding]
performance.measure.bind(performance, '\u200b' + name, options),
performance.measure.bind(performance, measureName, options),
);
} else {
performance.measure('\u200b' + name, options);
performance.measure(measureName, options);
}
performance.clearMeasures(measureName);
} else {
console.timeStamp(
name,
Expand Down Expand Up @@ -464,14 +469,16 @@ function logComponentEffectErrored(
},
};
const debugTask = fiber._debugTask;
const measureName = '\u200b' + name;
if (debugTask) {
debugTask.run(
// $FlowFixMe[method-unbinding]
performance.measure.bind(performance, '\u200b' + name, options),
performance.measure.bind(performance, measureName, options),
);
} else {
performance.measure('\u200b' + name, options);
performance.measure(measureName, options);
}
performance.clearMeasures(measureName);
} else {
console.timeStamp(
name,
Expand Down
Loading