Skip to content

Commit 9c6ff13

Browse files
authored
Remove timeout from performance flamegraph (#15477)
The implementation is wrong, but also it's not that useful for debugging. Implementing it properly would involve tracking more information than we do currently. Perhaps including the priority of the callback in the message would be helpful, but not sure. For now I'll just remove it.
1 parent 299a271 commit 9c6ff13

File tree

3 files changed

+36
-38
lines changed

3 files changed

+36
-38
lines changed

packages/react-reconciler/src/ReactDebugFiberPerf.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,15 @@ export function startRequestCallbackTimer(): void {
248248
}
249249
}
250250

251-
export function stopRequestCallbackTimer(
252-
didExpire: boolean,
253-
expirationTime: number,
254-
): void {
251+
export function stopRequestCallbackTimer(didExpire: boolean): void {
255252
if (enableUserTimingAPI) {
256253
if (supportsUserTiming) {
257254
isWaitingForCallback = false;
258-
const warning = didExpire ? 'React was blocked by main thread' : null;
255+
const warning = didExpire
256+
? 'Update expired; will flush synchronously'
257+
: null;
259258
endMark(
260-
`(Waiting for async callback... will force flush in ${expirationTime} ms)`,
259+
'(Waiting for async callback...)',
261260
'(Waiting for async callback...)',
262261
warning,
263262
);

packages/react-reconciler/src/ReactFiberScheduler.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,7 @@ function renderRoot(
703703

704704
if (enableUserTimingAPI && expirationTime !== Sync) {
705705
const didExpire = isSync;
706-
const timeoutMs = expirationTimeToMs(expirationTime);
707-
stopRequestCallbackTimer(didExpire, timeoutMs);
706+
stopRequestCallbackTimer(didExpire);
708707
}
709708

710709
if (root.firstPendingTime < expirationTime) {

packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`ReactDebugFiberPerf captures all lifecycles 1`] = `
4-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
4+
"⚛ (Waiting for async callback...)
55
66
// Mount
77
⚛ (React Tree Reconciliation: Completed Root)
@@ -15,7 +15,7 @@ exports[`ReactDebugFiberPerf captures all lifecycles 1`] = `
1515
⚛ (Calling Lifecycle Methods: 1 Total)
1616
⚛ AllLifecycles.componentDidMount
1717
18-
⚛ (Waiting for async callback... will force flush in 5250 ms)
18+
⚛ (Waiting for async callback...)
1919
2020
// Update
2121
⚛ (React Tree Reconciliation: Completed Root)
@@ -31,7 +31,7 @@ exports[`ReactDebugFiberPerf captures all lifecycles 1`] = `
3131
⚛ (Calling Lifecycle Methods: 2 Total)
3232
⚛ AllLifecycles.componentDidUpdate
3333
34-
⚛ (Waiting for async callback... will force flush in 5250 ms)
34+
⚛ (Waiting for async callback...)
3535
3636
// Unmount
3737
⚛ (React Tree Reconciliation: Completed Root)
@@ -45,7 +45,7 @@ exports[`ReactDebugFiberPerf captures all lifecycles 1`] = `
4545
`;
4646

4747
exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduce overhead 1`] = `
48-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
48+
"⚛ (Waiting for async callback...)
4949
5050
// The commit phase should mention A and B just once
5151
⚛ (React Tree Reconciliation: Completed Root)
@@ -62,7 +62,7 @@ exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduc
6262
⚛ A.componentDidUpdate
6363
⚛ B.componentDidUpdate
6464
65-
⚛ (Waiting for async callback... will force flush in 5250 ms)
65+
⚛ (Waiting for async callback...)
6666
6767
// Because of deduplication, we don't know B was cascading,
6868
// but we should still see the warning for the commit phase.
@@ -92,7 +92,7 @@ exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduc
9292
`;
9393

9494
exports[`ReactDebugFiberPerf does not include ConcurrentMode, StrictMode, or Profiler components in measurements 1`] = `
95-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
95+
"⚛ (Waiting for async callback...)
9696
9797
// Mount
9898
⚛ (React Tree Reconciliation: Completed Root)
@@ -108,7 +108,7 @@ exports[`ReactDebugFiberPerf does not include ConcurrentMode, StrictMode, or Pro
108108
`;
109109

110110
exports[`ReactDebugFiberPerf does not include context provider or consumer in measurements 1`] = `
111-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
111+
"⚛ (Waiting for async callback...)
112112
113113
// Mount
114114
⚛ (React Tree Reconciliation: Completed Root)
@@ -143,7 +143,7 @@ exports[`ReactDebugFiberPerf does not schedule an extra callback if setState is
143143
`;
144144

145145
exports[`ReactDebugFiberPerf does not treat setState from cWM or cWRP as cascading 1`] = `
146-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
146+
"⚛ (Waiting for async callback...)
147147
148148
// Should not print a warning
149149
⚛ (React Tree Reconciliation: Completed Root)
@@ -156,7 +156,7 @@ exports[`ReactDebugFiberPerf does not treat setState from cWM or cWRP as cascadi
156156
⚛ (Committing Host Effects: 1 Total)
157157
⚛ (Calling Lifecycle Methods: 0 Total)
158158
159-
⚛ (Waiting for async callback... will force flush in 5250 ms)
159+
⚛ (Waiting for async callback...)
160160
161161
// Should not print a warning
162162
⚛ (React Tree Reconciliation: Completed Root)
@@ -172,7 +172,7 @@ exports[`ReactDebugFiberPerf does not treat setState from cWM or cWRP as cascadi
172172
`;
173173

174174
exports[`ReactDebugFiberPerf measures a simple reconciliation 1`] = `
175-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
175+
"⚛ (Waiting for async callback...)
176176
177177
// Mount
178178
⚛ (React Tree Reconciliation: Completed Root)
@@ -184,7 +184,7 @@ exports[`ReactDebugFiberPerf measures a simple reconciliation 1`] = `
184184
⚛ (Committing Host Effects: 1 Total)
185185
⚛ (Calling Lifecycle Methods: 0 Total)
186186
187-
⚛ (Waiting for async callback... will force flush in 5250 ms)
187+
⚛ (Waiting for async callback...)
188188
189189
// Update
190190
⚛ (React Tree Reconciliation: Completed Root)
@@ -196,7 +196,7 @@ exports[`ReactDebugFiberPerf measures a simple reconciliation 1`] = `
196196
⚛ (Committing Host Effects: 2 Total)
197197
⚛ (Calling Lifecycle Methods: 2 Total)
198198
199-
⚛ (Waiting for async callback... will force flush in 5250 ms)
199+
⚛ (Waiting for async callback...)
200200
201201
// Unmount
202202
⚛ (React Tree Reconciliation: Completed Root)
@@ -209,7 +209,7 @@ exports[`ReactDebugFiberPerf measures a simple reconciliation 1`] = `
209209
`;
210210

211211
exports[`ReactDebugFiberPerf measures deferred work in chunks 1`] = `
212-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
212+
"⚛ (Waiting for async callback...)
213213
214214
// Start rendering through B
215215
⚛ (React Tree Reconciliation: Yielded)
@@ -218,7 +218,7 @@ exports[`ReactDebugFiberPerf measures deferred work in chunks 1`] = `
218218
⚛ Child [mount]
219219
⚛ B [mount]
220220
221-
⚛ (Waiting for async callback... will force flush in 5250 ms)
221+
⚛ (Waiting for async callback...)
222222
223223
// Complete the rest
224224
⚛ (React Tree Reconciliation: Completed Root)
@@ -245,7 +245,7 @@ exports[`ReactDebugFiberPerf measures deprioritized work 1`] = `
245245
⚛ (Committing Host Effects: 1 Total)
246246
⚛ (Calling Lifecycle Methods: 0 Total)
247247
248-
⚛ (Waiting for async callback... will force flush in 10737418210 ms)
248+
⚛ (Waiting for async callback...)
249249
250250
// Flush the child
251251
⚛ (React Tree Reconciliation: Completed Root)
@@ -259,7 +259,7 @@ exports[`ReactDebugFiberPerf measures deprioritized work 1`] = `
259259
`;
260260

261261
exports[`ReactDebugFiberPerf properly displays the forwardRef component in measurements 1`] = `
262-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
262+
"⚛ (Waiting for async callback...)
263263
264264
// Mount
265265
⚛ (React Tree Reconciliation: Completed Root)
@@ -279,7 +279,7 @@ exports[`ReactDebugFiberPerf properly displays the forwardRef component in measu
279279
`;
280280

281281
exports[`ReactDebugFiberPerf recovers from caught errors 1`] = `
282-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
282+
"⚛ (Waiting for async callback...)
283283
284284
// Stop on Baddie and restart from Boundary
285285
⚛ (React Tree Reconciliation: Completed Root)
@@ -313,7 +313,7 @@ exports[`ReactDebugFiberPerf recovers from caught errors 1`] = `
313313
`;
314314

315315
exports[`ReactDebugFiberPerf recovers from fatal errors 1`] = `
316-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
316+
"⚛ (Waiting for async callback...)
317317
318318
// Will fatal
319319
⚛ (React Tree Reconciliation: Completed Root)
@@ -329,7 +329,7 @@ exports[`ReactDebugFiberPerf recovers from fatal errors 1`] = `
329329
⚛ (Committing Host Effects: 1 Total)
330330
⚛ (Calling Lifecycle Methods: 1 Total)
331331
332-
⚛ (Waiting for async callback... will force flush in 5250 ms)
332+
⚛ (Waiting for async callback...)
333333
334334
// Will reconcile from a clean state
335335
⚛ (React Tree Reconciliation: Completed Root)
@@ -344,7 +344,7 @@ exports[`ReactDebugFiberPerf recovers from fatal errors 1`] = `
344344
`;
345345

346346
exports[`ReactDebugFiberPerf skips parents during setState 1`] = `
347-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
347+
"⚛ (Waiting for async callback...)
348348
349349
// Should include just A and B, no Parents
350350
⚛ (React Tree Reconciliation: Completed Root)
@@ -359,7 +359,7 @@ exports[`ReactDebugFiberPerf skips parents during setState 1`] = `
359359
`;
360360

361361
exports[`ReactDebugFiberPerf supports Suspense and lazy 1`] = `
362-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
362+
"⚛ (Waiting for async callback...)
363363
364364
⚛ (React Tree Reconciliation: Completed Root)
365365
⚛ Parent [mount]
@@ -370,15 +370,15 @@ exports[`ReactDebugFiberPerf supports Suspense and lazy 1`] = `
370370
`;
371371

372372
exports[`ReactDebugFiberPerf supports Suspense and lazy 2`] = `
373-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
373+
"⚛ (Waiting for async callback...)
374374
375375
⚛ (React Tree Reconciliation: Completed Root)
376376
⚛ Parent [mount]
377377
⛔ Suspense [mount] Warning: Rendering was suspended
378378
⚛ Suspense [mount]
379379
⚛ Spinner [mount]
380380
381-
⚛ (Waiting for async callback... will force flush in 5250 ms)
381+
⚛ (Waiting for async callback...)
382382
383383
⚛ (React Tree Reconciliation: Completed Root)
384384
⚛ Parent [mount]
@@ -393,7 +393,7 @@ exports[`ReactDebugFiberPerf supports Suspense and lazy 2`] = `
393393
`;
394394

395395
exports[`ReactDebugFiberPerf supports memo 1`] = `
396-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
396+
"⚛ (Waiting for async callback...)
397397
398398
⚛ (React Tree Reconciliation: Completed Root)
399399
⚛ Parent [mount]
@@ -407,7 +407,7 @@ exports[`ReactDebugFiberPerf supports memo 1`] = `
407407
`;
408408

409409
exports[`ReactDebugFiberPerf supports portals 1`] = `
410-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
410+
"⚛ (Waiting for async callback...)
411411
412412
⚛ (React Tree Reconciliation: Completed Root)
413413
⚛ Parent [mount]
@@ -421,12 +421,12 @@ exports[`ReactDebugFiberPerf supports portals 1`] = `
421421
`;
422422

423423
exports[`ReactDebugFiberPerf warns if an in-progress update is interrupted 1`] = `
424-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
424+
"⚛ (Waiting for async callback...)
425425
426426
⚛ (React Tree Reconciliation: Yielded)
427427
⚛ Foo [mount]
428428
429-
⚛ (Waiting for async callback... will force flush in 5250 ms)
429+
⚛ (Waiting for async callback...)
430430
⛔ (React Tree Reconciliation: Completed Root) Warning: A top-level update interrupted the previous render
431431
⚛ Foo [mount]
432432
⚛ (Committing Changes)
@@ -444,7 +444,7 @@ exports[`ReactDebugFiberPerf warns if an in-progress update is interrupted 1`] =
444444
`;
445445

446446
exports[`ReactDebugFiberPerf warns if async work expires (starvation) 1`] = `
447-
"⛔ (Waiting for async callback... will force flush in 5250 ms) Warning: React was blocked by main thread
447+
"⛔ (Waiting for async callback...) Warning: Update expired; will flush synchronously
448448
449449
⚛ (Committing Changes)
450450
⚛ (Committing Snapshot Effects: 0 Total)
@@ -454,7 +454,7 @@ exports[`ReactDebugFiberPerf warns if async work expires (starvation) 1`] = `
454454
`;
455455

456456
exports[`ReactDebugFiberPerf warns on cascading renders from setState 1`] = `
457-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
457+
"⚛ (Waiting for async callback...)
458458
459459
// Should print a warning
460460
⚛ (React Tree Reconciliation: Completed Root)
@@ -478,7 +478,7 @@ exports[`ReactDebugFiberPerf warns on cascading renders from setState 1`] = `
478478
`;
479479

480480
exports[`ReactDebugFiberPerf warns on cascading renders from top-level render 1`] = `
481-
"⚛ (Waiting for async callback... will force flush in 5250 ms)
481+
"⚛ (Waiting for async callback...)
482482
483483
// Rendering the first root
484484
⚛ (React Tree Reconciliation: Completed Root)

0 commit comments

Comments
 (0)