File tree Expand file tree Collapse file tree
packages/react-reconciler/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ import getComponentNameFromFiber from './getComponentNameFromFiber';
1313
1414import { getGroupNameOfHighestPriorityLane } from './ReactFiberLane' ;
1515
16+ import { enableProfilerTimer } from 'shared/ReactFeatureFlags' ;
17+
18+ const supportsUserTiming =
19+ enableProfilerTimer &&
20+ typeof performance !== 'undefined' &&
21+ // $FlowFixMe[method-unbinding]
22+ typeof performance . measure === 'function' ;
23+
1624const TRACK_GROUP = 'Components ⚛' ;
1725
1826// Reused to avoid thrashing the GC.
@@ -45,7 +53,9 @@ export function logComponentRender(
4553 // Skip
4654 return ;
4755 }
48- reusableComponentOptions . start = startTime ;
49- reusableComponentOptions . end = endTime ;
50- performance . measure ( name , reusableComponentOptions ) ;
56+ if ( supportsUserTiming ) {
57+ reusableComponentOptions . start = startTime ;
58+ reusableComponentOptions . end = endTime ;
59+ performance . measure ( name , reusableComponentOptions ) ;
60+ }
5161}
You can’t perform that action at this time.
0 commit comments