Temporarily Remove DebugTracing from the New Reconciler (#18697)
* Remove priority field from tracing * Remove DebugTracing mode from new reconciler (temporarily) * Run DebugTracing tests in the *other* variant so it's no on for new reconciler
Sebastian Markbåge committed
Apr 21, 2020 at 20:14 UTC
571f5ad2d695e6373ffbd8e86b27c11dad3d22cf
6 files changed
+5
-202
packages/react-reconciler/src/ReactFiberClassComponent.new.js
+1
-41
@@ -10,14 +10,12 @@
10
import type {Fiber} from './ReactInternalTypes';
11
import type {ExpirationTime} from './ReactFiberExpirationTime.new';
12
import type {UpdateQueue} from './ReactUpdateQueue.new';
13
-import type {ReactPriorityLevel} from './ReactInternalTypes';
13
14
import * as React from 'react';
15
import {Update, Snapshot} from './ReactSideEffectTags';
16
import {
17
debugRenderPhaseSideEffectsForStrictMode,
18
disableLegacyContext,
20
- enableDebugTracing,
19
warnAboutDeprecatedLifecycles,
20
} from 'shared/ReactFeatureFlags';
21
import ReactStrictModeWarnings from './ReactStrictModeWarnings.new';
@@ -29,7 +27,7 @@ import invariant from 'shared/invariant';
27
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
28
29
import {resolveDefaultProps} from './ReactFiberLazyComponent.new';
32
-import {DebugTracingMode, StrictMode} from './ReactTypeOfMode';
30
+import {StrictMode} from './ReactTypeOfMode';
31
32
import {
33
enqueueUpdate,
@@ -55,10 +53,8 @@ import {
53
requestCurrentTimeForUpdate,
54
computeExpirationForFiber,
55
scheduleUpdateOnFiber,
58
- priorityLevelToLabel,
56
} from './ReactFiberWorkLoop.new';
57
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
61
-import {logForceUpdateScheduled, logStateUpdateScheduled} from './DebugTracing';
58
59
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
60
@@ -211,18 +207,6 @@ const classComponentUpdater = {
207
208
enqueueUpdate(fiber, update);
209
scheduleUpdateOnFiber(fiber, expirationTime);
214
-
215
- if (__DEV__) {
216
- if (enableDebugTracing) {
217
- if (fiber.mode & DebugTracingMode) {
218
- const label = priorityLevelToLabel(
219
- ((update.priority: any): ReactPriorityLevel),
220
- );
221
- const name = getComponentName(fiber.type) || 'Unknown';
222
- logStateUpdateScheduled(name, label, payload);
223
- }
224
- }
225
- }
210
},
211
enqueueReplaceState(inst, payload, callback) {
212
const fiber = getInstance(inst);
@@ -247,18 +231,6 @@ const classComponentUpdater = {
231
232
enqueueUpdate(fiber, update);
233
scheduleUpdateOnFiber(fiber, expirationTime);
250
-
251
- if (__DEV__) {
252
- if (enableDebugTracing) {
253
- if (fiber.mode & DebugTracingMode) {
254
- const label = priorityLevelToLabel(
255
- ((update.priority: any): ReactPriorityLevel),
256
- );
257
- const name = getComponentName(fiber.type) || 'Unknown';
258
- logStateUpdateScheduled(name, label, payload);
259
- }
260
- }
261
- }
234
},
235
enqueueForceUpdate(inst, callback) {
236
const fiber = getInstance(inst);
@@ -282,18 +254,6 @@ const classComponentUpdater = {
254
255
enqueueUpdate(fiber, update);
256
scheduleUpdateOnFiber(fiber, expirationTime);
285
-
286
- if (__DEV__) {
287
- if (enableDebugTracing) {
288
- if (fiber.mode & DebugTracingMode) {
289
- const label = priorityLevelToLabel(
290
- ((update.priority: any): ReactPriorityLevel),
291
- );
292
- const name = getComponentName(fiber.type) || 'Unknown';
293
- logForceUpdateScheduled(name, label);
294
- }
295
- }
296
- }
257
},
258
};
259
packages/react-reconciler/src/ReactFiberHooks.new.js
+2
-27
@@ -24,15 +24,10 @@ import type {FiberRoot} from './ReactInternalTypes';
24
import type {OpaqueIDType} from './ReactFiberHostConfig';
25
26
import ReactSharedInternals from 'shared/ReactSharedInternals';
27
-import {enableDebugTracing} from 'shared/ReactFeatureFlags';
27
28
import {markRootExpiredAtTime} from './ReactFiberRoot.new';
30
-import {
31
- inferPriorityFromExpirationTime,
32
- NoWork,
33
- Sync,
34
-} from './ReactFiberExpirationTime.new';
35
-import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
29
+import {NoWork, Sync} from './ReactFiberExpirationTime.new';
30
+import {NoMode, BlockingMode} from './ReactTypeOfMode';
31
import {readContext} from './ReactFiberNewContext.new';
32
import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents.new';
33
import {
@@ -54,7 +49,6 @@ import {
49
warnIfNotScopedWithMatchingAct,
50
markRenderEventTimeAndConfig,
51
markUnprocessedUpdateTime,
57
- priorityLevelToLabel,
52
} from './ReactFiberWorkLoop.new';
53
54
import invariant from 'shared/invariant';
@@ -83,7 +77,6 @@ import {
77
warnAboutMultipleRenderersDEV,
78
} from './ReactMutableSource.new';
79
import {getIsRendering} from './ReactCurrentFiber';
86
-import {logStateUpdateScheduled} from './DebugTracing';
80
81
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
82
@@ -1655,10 +1648,6 @@ function dispatchAction<S, A>(
1648
next: (null: any),
1649
};
1650
1658
- if (__DEV__) {
1659
- update.priority = getCurrentPriorityLevel();
1660
- }
1661
-
1651
// Append the update to the end of the list.
1652
const pending = queue.pending;
1653
if (pending === null) {
@@ -1729,20 +1718,6 @@ function dispatchAction<S, A>(
1718
}
1719
scheduleUpdateOnFiber(fiber, expirationTime);
1720
}
1732
-
1733
- if (__DEV__) {
1734
- if (enableDebugTracing) {
1735
- if (fiber.mode & DebugTracingMode) {
1736
- const priorityLevel = inferPriorityFromExpirationTime(
1737
- currentTime,
1738
- expirationTime,
1739
- );
1740
- const label = priorityLevelToLabel(priorityLevel);
1741
- const name = getComponentName(fiber.type) || 'Unknown';
1742
- logStateUpdateScheduled(name, label, action);
1743
- }
1744
- }
1745
- }
1721
}
1722
1723
export const ContextOnlyDispatcher: Dispatcher = {
packages/react-reconciler/src/ReactFiberThrow.new.js
+1
-12
@@ -30,8 +30,7 @@ import {
30
LifecycleEffectMask,
31
} from './ReactSideEffectTags';
32
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.new';
33
-import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
34
-import {enableDebugTracing} from 'shared/ReactFeatureFlags';
33
+import {NoMode, BlockingMode} from './ReactTypeOfMode';
34
import {createCapturedValue} from './ReactCapturedValue';
35
import {
36
enqueueCapturedUpdate,
@@ -55,7 +54,6 @@ import {
54
pingSuspendedRoot,
55
} from './ReactFiberWorkLoop.new';
56
import {logCapturedError} from './ReactFiberErrorLogger';
58
-import {logComponentSuspended} from './DebugTracing';
57
58
import {Sync, NoWork} from './ReactFiberExpirationTime.new';
59
@@ -195,15 +193,6 @@ function throwException(
193
// This is a wakeable.
194
const wakeable: Wakeable = (value: any);
195
198
- if (__DEV__) {
199
- if (enableDebugTracing) {
200
- if (sourceFiber.mode & DebugTracingMode) {
201
- const name = getComponentName(sourceFiber.type) || 'Unknown';
202
- logComponentSuspended(name, wakeable);
203
- }
204
- }
205
- }
206
-
196
if ((sourceFiber.mode & BlockingMode) === NoMode) {
197
// Reset the memoizedState to what it was before we attempted
198
// to render it.
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
-113
@@ -27,7 +27,6 @@ import {
27
enableSchedulerTracing,
28
warnAboutUnmockedScheduler,
29
disableSchedulerTimeoutBasedOnReactExpirationTime,
30
- enableDebugTracing,
30
} from 'shared/ReactFeatureFlags';
31
import ReactSharedInternals from 'shared/ReactSharedInternals';
32
import invariant from 'shared/invariant';
@@ -49,16 +48,6 @@ import {
48
flushSyncCallbackQueue,
49
scheduleSyncCallback,
50
} from './SchedulerWithReactIntegration.new';
52
-import {
53
- logCommitStarted,
54
- logCommitStopped,
55
- logLayoutEffectsStarted,
56
- logLayoutEffectsStopped,
57
- logPassiveEffectsStarted,
58
- logPassiveEffectsStopped,
59
- logRenderStarted,
60
- logRenderStopped,
61
-} from './DebugTracing';
51
52
// The scheduler is imported here *only* to detect whether it's been mocked
53
import * as Scheduler from 'scheduler';
@@ -396,29 +385,6 @@ export function computeExpirationForFiber(
385
return expirationTime;
386
}
387
399
-export function priorityLevelToLabel(
400
- priorityLevel: ReactPriorityLevel,
401
-): string {
402
- if (__DEV__ && enableDebugTracing) {
403
- switch (priorityLevel) {
404
- case ImmediatePriority:
405
- return 'immediate';
406
- case UserBlockingPriority:
407
- return 'user-blocking';
408
- case NormalPriority:
409
- return 'normal';
410
- case LowPriority:
411
- return 'low';
412
- case IdlePriority:
413
- return 'idle';
414
- default:
415
- return 'other';
416
- }
417
- } else {
418
- return '';
419
- }
420
-}
421
-
388
export function scheduleUpdateOnFiber(
389
fiber: Fiber,
390
expirationTime: ExpirationTime,
@@ -1428,14 +1394,6 @@ function renderRootSync(root, expirationTime) {
1394
1395
const prevInteractions = pushInteractions(root);
1396
1431
- if (__DEV__) {
1432
- if (enableDebugTracing) {
1433
- const priorityLevel = getCurrentPriorityLevel();
1434
- const label = priorityLevelToLabel(priorityLevel);
1435
- logRenderStarted(label);
1436
- }
1437
- }
1438
-
1397
do {
1398
try {
1399
workLoopSync();
@@ -1461,12 +1419,6 @@ function renderRootSync(root, expirationTime) {
1419
);
1420
}
1421
1464
- if (__DEV__) {
1465
- if (enableDebugTracing) {
1466
- logRenderStopped();
1467
- }
1468
- }
1469
-
1422
// Set this to null to indicate there's no in-progress render.
1423
workInProgressRoot = null;
1424
@@ -1496,14 +1448,6 @@ function renderRootConcurrent(root, expirationTime) {
1448
1449
const prevInteractions = pushInteractions(root);
1450
1499
- if (__DEV__) {
1500
- if (enableDebugTracing) {
1501
- const priorityLevel = getCurrentPriorityLevel();
1502
- const label = priorityLevelToLabel(priorityLevel);
1503
- logRenderStarted(label);
1504
- }
1505
- }
1506
-
1451
do {
1452
try {
1453
workLoopConcurrent();
@@ -1520,12 +1464,6 @@ function renderRootConcurrent(root, expirationTime) {
1464
popDispatcher(prevDispatcher);
1465
executionContext = prevExecutionContext;
1466
1523
- if (__DEV__) {
1524
- if (enableDebugTracing) {
1525
- logRenderStopped();
1526
- }
1527
- }
1528
-
1467
// Check if the tree has completed.
1468
if (workInProgress !== null) {
1469
// Still work remaining.
@@ -1793,12 +1731,6 @@ function commitRoot(root) {
1731
}
1732
1733
function commitRootImpl(root, renderPriorityLevel) {
1796
- if (__DEV__) {
1797
- if (enableDebugTracing) {
1798
- const label = priorityLevelToLabel(renderPriorityLevel);
1799
- logCommitStarted(label);
1800
- }
1801
- }
1734
do {
1735
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
1736
// means `flushPassiveEffects` will sometimes result in additional
@@ -1818,11 +1750,6 @@ function commitRootImpl(root, renderPriorityLevel) {
1750
const finishedWork = root.finishedWork;
1751
const expirationTime = root.finishedExpirationTime;
1752
if (finishedWork === null) {
1821
- if (__DEV__) {
1822
- if (enableDebugTracing) {
1823
- logCommitStopped();
1824
- }
1825
- }
1753
return null;
1754
}
1755
root.finishedWork = null;
@@ -2112,12 +2039,6 @@ function commitRootImpl(root, renderPriorityLevel) {
2039
}
2040
2041
if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
2115
- if (__DEV__) {
2116
- if (enableDebugTracing) {
2117
- logCommitStopped();
2118
- }
2119
- }
2120
-
2042
// This is a legacy edge case. We just committed the initial mount of
2043
// a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
2044
// synchronously, but layout updates should be deferred until the end
@@ -2128,12 +2049,6 @@ function commitRootImpl(root, renderPriorityLevel) {
2049
// If layout work was scheduled, flush it now.
2050
flushSyncCallbackQueue();
2051
2131
- if (__DEV__) {
2132
- if (enableDebugTracing) {
2133
- logCommitStopped();
2134
- }
2135
- }
2136
-
2052
return null;
2053
}
2054
@@ -2249,14 +2164,6 @@ function commitLayoutEffects(
2164
root: FiberRoot,
2165
committedExpirationTime: ExpirationTime,
2166
) {
2252
- if (__DEV__) {
2253
- if (enableDebugTracing) {
2254
- const priorityLevel = getCurrentPriorityLevel();
2255
- const label = priorityLevelToLabel(priorityLevel);
2256
- logLayoutEffectsStarted(label);
2257
- }
2258
- }
2259
-
2167
// TODO: Should probably move the bulk of this function to commitWork.
2168
while (nextEffect !== null) {
2169
setCurrentDebugFiberInDEV(nextEffect);
@@ -2280,12 +2187,6 @@ function commitLayoutEffects(
2187
resetCurrentDebugFiberInDEV();
2188
nextEffect = nextEffect.nextEffect;
2189
}
2283
-
2284
- if (__DEV__) {
2285
- if (enableDebugTracing) {
2286
- logLayoutEffectsStopped();
2287
- }
2288
- }
2190
}
2191
2192
export function flushPassiveEffects() {
@@ -2373,14 +2274,6 @@ function flushPassiveEffectsImpl() {
2274
'Cannot flush passive effects while already rendering.',
2275
);
2276
2376
- if (__DEV__) {
2377
- if (enableDebugTracing) {
2378
- const priorityLevel = getCurrentPriorityLevel();
2379
- const label = priorityLevelToLabel(priorityLevel);
2380
- logPassiveEffectsStarted(label);
2381
- }
2382
- }
2383
-
2277
if (__DEV__) {
2278
isFlushingPassiveEffects = true;
2279
}
@@ -2559,12 +2452,6 @@ function flushPassiveEffectsImpl() {
2452
isFlushingPassiveEffects = false;
2453
}
2454
2562
- if (__DEV__) {
2563
- if (enableDebugTracing) {
2564
- logPassiveEffectsStopped();
2565
- }
2566
- }
2567
-
2455
executionContext = prevExecutionContext;
2456
2457
flushSyncCallbackQueue();
packages/react-reconciler/src/ReactUpdateQueue.new.js
-8
@@ -87,7 +87,6 @@
87
import type {Fiber} from './ReactInternalTypes';
88
import type {ExpirationTime} from './ReactFiberExpirationTime.new';
89
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
90
-import type {ReactPriorityLevel} from './ReactInternalTypes';
90
91
import {NoWork, Sync} from './ReactFiberExpirationTime.new';
92
import {
@@ -105,7 +104,6 @@ import {
104
} from './ReactFiberWorkLoop.new';
105
106
import invariant from 'shared/invariant';
108
-import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration.new';
107
108
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
109
@@ -121,9 +119,6 @@ export type Update<State> = {|
119
callback: (() => mixed) | null,
120
121
next: Update<State> | null,
124
-
125
- // DEV only
126
- priority?: ReactPriorityLevel,
122
|};
123
124
type SharedQueue<State> = {|
@@ -207,9 +202,6 @@ export function createUpdate(
202
203
next: null,
204
};
210
- if (__DEV__) {
211
- update.priority = getCurrentPriorityLevel();
212
- }
205
return update;
206
}
207
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
+1
-1
@@ -19,7 +19,7 @@ export const disableInputAttributeSyncing = __VARIANT__;
19
export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
20
export const enableModernEventSystem = __VARIANT__;
21
export const enableLegacyFBSupport = __VARIANT__;
22
-export const enableDebugTracing = __VARIANT__;
22
+export const enableDebugTracing = !__VARIANT__;
23
24
// These are already tested in both modes using the build type dimension,
25
// so we don't need to use __VARIANT__ to get extra coverage.