Skip to content

Commit 7ca2d4c

Browse files
authored
Work around Chrome DevTools crash on performance.measure (facebook#33997)
1 parent 99be14c commit 7ca2d4c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/react-client/src/ReactFlightPerformanceTrack.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function logComponentRender(
110110
}
111111
debugTask.run(
112112
// $FlowFixMe[method-unbinding]
113-
performance.measure.bind(performance, entryName, {
113+
performance.measure.bind(performance, '\u200b' + entryName, {
114114
start: startTime < 0 ? 0 : startTime,
115115
end: childrenEndTime,
116116
detail: {
@@ -125,7 +125,7 @@ export function logComponentRender(
125125
);
126126
} else {
127127
console.timeStamp(
128-
entryName,
128+
'\u200b' + entryName,
129129
startTime < 0 ? 0 : startTime,
130130
childrenEndTime,
131131
trackNames[trackIdx],
@@ -163,7 +163,7 @@ export function logComponentAborted(
163163
if (componentInfo.props != null) {
164164
addObjectToProperties(componentInfo.props, properties, 0, '');
165165
}
166-
performance.measure(entryName, {
166+
performance.measure('\u200b' + entryName, {
167167
start: startTime < 0 ? 0 : startTime,
168168
end: childrenEndTime,
169169
detail: {
@@ -220,7 +220,7 @@ export function logComponentErrored(
220220
if (componentInfo.props != null) {
221221
addObjectToProperties(componentInfo.props, properties, 0, '');
222222
}
223-
performance.measure(entryName, {
223+
performance.measure('\u200b' + entryName, {
224224
start: startTime < 0 ? 0 : startTime,
225225
end: childrenEndTime,
226226
detail: {
@@ -614,7 +614,7 @@ export function logIOInfoErrored(
614614
getIOLongName(ioInfo, description, ioInfo.env, rootEnv) + ' Rejected';
615615
debugTask.run(
616616
// $FlowFixMe[method-unbinding]
617-
performance.measure.bind(performance, entryName, {
617+
performance.measure.bind(performance, '\u200b' + entryName, {
618618
start: startTime < 0 ? 0 : startTime,
619619
end: endTime,
620620
detail: {
@@ -667,7 +667,7 @@ export function logIOInfo(
667667
);
668668
debugTask.run(
669669
// $FlowFixMe[method-unbinding]
670-
performance.measure.bind(performance, entryName, {
670+
performance.measure.bind(performance, '\u200b' + entryName, {
671671
start: startTime < 0 ? 0 : startTime,
672672
end: endTime,
673673
detail: {

packages/react-reconciler/src/ReactFiberPerformanceTrack.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export function logComponentRender(
272272
// $FlowFixMe[method-unbinding]
273273
performance.measure.bind(
274274
performance,
275-
name,
275+
'\u200b' + name,
276276
reusableComponentOptions,
277277
),
278278
);
@@ -369,10 +369,10 @@ export function logComponentErrored(
369369
if (__DEV__ && debugTask) {
370370
debugTask.run(
371371
// $FlowFixMe[method-unbinding]
372-
performance.measure.bind(performance, name, options),
372+
performance.measure.bind(performance, '\u200b' + name, options),
373373
);
374374
} else {
375-
performance.measure(name, options);
375+
performance.measure('\u200b' + name, options);
376376
}
377377
} else {
378378
console.timeStamp(
@@ -436,10 +436,10 @@ function logComponentEffectErrored(
436436
if (debugTask) {
437437
debugTask.run(
438438
// $FlowFixMe[method-unbinding]
439-
performance.measure.bind(performance, name, options),
439+
performance.measure.bind(performance, '\u200b' + name, options),
440440
);
441441
} else {
442-
performance.measure(name, options);
442+
performance.measure('\u200b' + name, options);
443443
}
444444
} else {
445445
console.timeStamp(

packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ describe('ReactFlightAsyncDebugInfo', () => {
610610
expect(entries).toMatchInlineSnapshot(`
611611
[
612612
{
613-
"name": "Component",
613+
"name": "\u200bComponent",
614614
},
615615
{
616616
"name": "await getData (…/pulls)",

0 commit comments

Comments
 (0)