mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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
This commit is contained in:
@@ -10,14 +10,12 @@
|
||||
import type {Fiber} from './ReactInternalTypes';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.new';
|
||||
import type {UpdateQueue} from './ReactUpdateQueue.new';
|
||||
import type {ReactPriorityLevel} from './ReactInternalTypes';
|
||||
|
||||
import * as React from 'react';
|
||||
import {Update, Snapshot} from './ReactSideEffectTags';
|
||||
import {
|
||||
debugRenderPhaseSideEffectsForStrictMode,
|
||||
disableLegacyContext,
|
||||
enableDebugTracing,
|
||||
warnAboutDeprecatedLifecycles,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings.new';
|
||||
@@ -29,7 +27,7 @@ import invariant from 'shared/invariant';
|
||||
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
|
||||
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent.new';
|
||||
import {DebugTracingMode, StrictMode} from './ReactTypeOfMode';
|
||||
import {StrictMode} from './ReactTypeOfMode';
|
||||
|
||||
import {
|
||||
enqueueUpdate,
|
||||
@@ -55,10 +53,8 @@ import {
|
||||
requestCurrentTimeForUpdate,
|
||||
computeExpirationForFiber,
|
||||
scheduleUpdateOnFiber,
|
||||
priorityLevelToLabel,
|
||||
} from './ReactFiberWorkLoop.new';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import {logForceUpdateScheduled, logStateUpdateScheduled} from './DebugTracing';
|
||||
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
|
||||
@@ -211,18 +207,6 @@ const classComponentUpdater = {
|
||||
|
||||
enqueueUpdate(fiber, update);
|
||||
scheduleUpdateOnFiber(fiber, expirationTime);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
if (fiber.mode & DebugTracingMode) {
|
||||
const label = priorityLevelToLabel(
|
||||
((update.priority: any): ReactPriorityLevel),
|
||||
);
|
||||
const name = getComponentName(fiber.type) || 'Unknown';
|
||||
logStateUpdateScheduled(name, label, payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
enqueueReplaceState(inst, payload, callback) {
|
||||
const fiber = getInstance(inst);
|
||||
@@ -247,18 +231,6 @@ const classComponentUpdater = {
|
||||
|
||||
enqueueUpdate(fiber, update);
|
||||
scheduleUpdateOnFiber(fiber, expirationTime);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
if (fiber.mode & DebugTracingMode) {
|
||||
const label = priorityLevelToLabel(
|
||||
((update.priority: any): ReactPriorityLevel),
|
||||
);
|
||||
const name = getComponentName(fiber.type) || 'Unknown';
|
||||
logStateUpdateScheduled(name, label, payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
enqueueForceUpdate(inst, callback) {
|
||||
const fiber = getInstance(inst);
|
||||
@@ -282,18 +254,6 @@ const classComponentUpdater = {
|
||||
|
||||
enqueueUpdate(fiber, update);
|
||||
scheduleUpdateOnFiber(fiber, expirationTime);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
if (fiber.mode & DebugTracingMode) {
|
||||
const label = priorityLevelToLabel(
|
||||
((update.priority: any): ReactPriorityLevel),
|
||||
);
|
||||
const name = getComponentName(fiber.type) || 'Unknown';
|
||||
logForceUpdateScheduled(name, label);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -24,15 +24,10 @@ import type {FiberRoot} from './ReactInternalTypes';
|
||||
import type {OpaqueIDType} from './ReactFiberHostConfig';
|
||||
|
||||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||
import {enableDebugTracing} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {markRootExpiredAtTime} from './ReactFiberRoot.new';
|
||||
import {
|
||||
inferPriorityFromExpirationTime,
|
||||
NoWork,
|
||||
Sync,
|
||||
} from './ReactFiberExpirationTime.new';
|
||||
import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime.new';
|
||||
import {NoMode, BlockingMode} from './ReactTypeOfMode';
|
||||
import {readContext} from './ReactFiberNewContext.new';
|
||||
import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents.new';
|
||||
import {
|
||||
@@ -54,7 +49,6 @@ import {
|
||||
warnIfNotScopedWithMatchingAct,
|
||||
markRenderEventTimeAndConfig,
|
||||
markUnprocessedUpdateTime,
|
||||
priorityLevelToLabel,
|
||||
} from './ReactFiberWorkLoop.new';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
@@ -83,7 +77,6 @@ import {
|
||||
warnAboutMultipleRenderersDEV,
|
||||
} from './ReactMutableSource.new';
|
||||
import {getIsRendering} from './ReactCurrentFiber';
|
||||
import {logStateUpdateScheduled} from './DebugTracing';
|
||||
|
||||
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
|
||||
|
||||
@@ -1655,10 +1648,6 @@ function dispatchAction<S, A>(
|
||||
next: (null: any),
|
||||
};
|
||||
|
||||
if (__DEV__) {
|
||||
update.priority = getCurrentPriorityLevel();
|
||||
}
|
||||
|
||||
// Append the update to the end of the list.
|
||||
const pending = queue.pending;
|
||||
if (pending === null) {
|
||||
@@ -1729,20 +1718,6 @@ function dispatchAction<S, A>(
|
||||
}
|
||||
scheduleUpdateOnFiber(fiber, expirationTime);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
if (fiber.mode & DebugTracingMode) {
|
||||
const priorityLevel = inferPriorityFromExpirationTime(
|
||||
currentTime,
|
||||
expirationTime,
|
||||
);
|
||||
const label = priorityLevelToLabel(priorityLevel);
|
||||
const name = getComponentName(fiber.type) || 'Unknown';
|
||||
logStateUpdateScheduled(name, label, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ContextOnlyDispatcher: Dispatcher = {
|
||||
|
||||
@@ -30,8 +30,7 @@ import {
|
||||
LifecycleEffectMask,
|
||||
} from './ReactSideEffectTags';
|
||||
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.new';
|
||||
import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
|
||||
import {enableDebugTracing} from 'shared/ReactFeatureFlags';
|
||||
import {NoMode, BlockingMode} from './ReactTypeOfMode';
|
||||
import {createCapturedValue} from './ReactCapturedValue';
|
||||
import {
|
||||
enqueueCapturedUpdate,
|
||||
@@ -55,7 +54,6 @@ import {
|
||||
pingSuspendedRoot,
|
||||
} from './ReactFiberWorkLoop.new';
|
||||
import {logCapturedError} from './ReactFiberErrorLogger';
|
||||
import {logComponentSuspended} from './DebugTracing';
|
||||
|
||||
import {Sync, NoWork} from './ReactFiberExpirationTime.new';
|
||||
|
||||
@@ -195,15 +193,6 @@ function throwException(
|
||||
// This is a wakeable.
|
||||
const wakeable: Wakeable = (value: any);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
if (sourceFiber.mode & DebugTracingMode) {
|
||||
const name = getComponentName(sourceFiber.type) || 'Unknown';
|
||||
logComponentSuspended(name, wakeable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((sourceFiber.mode & BlockingMode) === NoMode) {
|
||||
// Reset the memoizedState to what it was before we attempted
|
||||
// to render it.
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
enableSchedulerTracing,
|
||||
warnAboutUnmockedScheduler,
|
||||
disableSchedulerTimeoutBasedOnReactExpirationTime,
|
||||
enableDebugTracing,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||
import invariant from 'shared/invariant';
|
||||
@@ -49,16 +48,6 @@ import {
|
||||
flushSyncCallbackQueue,
|
||||
scheduleSyncCallback,
|
||||
} from './SchedulerWithReactIntegration.new';
|
||||
import {
|
||||
logCommitStarted,
|
||||
logCommitStopped,
|
||||
logLayoutEffectsStarted,
|
||||
logLayoutEffectsStopped,
|
||||
logPassiveEffectsStarted,
|
||||
logPassiveEffectsStopped,
|
||||
logRenderStarted,
|
||||
logRenderStopped,
|
||||
} from './DebugTracing';
|
||||
|
||||
// The scheduler is imported here *only* to detect whether it's been mocked
|
||||
import * as Scheduler from 'scheduler';
|
||||
@@ -396,29 +385,6 @@ export function computeExpirationForFiber(
|
||||
return expirationTime;
|
||||
}
|
||||
|
||||
export function priorityLevelToLabel(
|
||||
priorityLevel: ReactPriorityLevel,
|
||||
): string {
|
||||
if (__DEV__ && enableDebugTracing) {
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
return 'immediate';
|
||||
case UserBlockingPriority:
|
||||
return 'user-blocking';
|
||||
case NormalPriority:
|
||||
return 'normal';
|
||||
case LowPriority:
|
||||
return 'low';
|
||||
case IdlePriority:
|
||||
return 'idle';
|
||||
default:
|
||||
return 'other';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function scheduleUpdateOnFiber(
|
||||
fiber: Fiber,
|
||||
expirationTime: ExpirationTime,
|
||||
@@ -1428,14 +1394,6 @@ function renderRootSync(root, expirationTime) {
|
||||
|
||||
const prevInteractions = pushInteractions(root);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
const priorityLevel = getCurrentPriorityLevel();
|
||||
const label = priorityLevelToLabel(priorityLevel);
|
||||
logRenderStarted(label);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
try {
|
||||
workLoopSync();
|
||||
@@ -1461,12 +1419,6 @@ function renderRootSync(root, expirationTime) {
|
||||
);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logRenderStopped();
|
||||
}
|
||||
}
|
||||
|
||||
// Set this to null to indicate there's no in-progress render.
|
||||
workInProgressRoot = null;
|
||||
|
||||
@@ -1496,14 +1448,6 @@ function renderRootConcurrent(root, expirationTime) {
|
||||
|
||||
const prevInteractions = pushInteractions(root);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
const priorityLevel = getCurrentPriorityLevel();
|
||||
const label = priorityLevelToLabel(priorityLevel);
|
||||
logRenderStarted(label);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
try {
|
||||
workLoopConcurrent();
|
||||
@@ -1520,12 +1464,6 @@ function renderRootConcurrent(root, expirationTime) {
|
||||
popDispatcher(prevDispatcher);
|
||||
executionContext = prevExecutionContext;
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logRenderStopped();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the tree has completed.
|
||||
if (workInProgress !== null) {
|
||||
// Still work remaining.
|
||||
@@ -1793,12 +1731,6 @@ function commitRoot(root) {
|
||||
}
|
||||
|
||||
function commitRootImpl(root, renderPriorityLevel) {
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
const label = priorityLevelToLabel(renderPriorityLevel);
|
||||
logCommitStarted(label);
|
||||
}
|
||||
}
|
||||
do {
|
||||
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
||||
// means `flushPassiveEffects` will sometimes result in additional
|
||||
@@ -1818,11 +1750,6 @@ function commitRootImpl(root, renderPriorityLevel) {
|
||||
const finishedWork = root.finishedWork;
|
||||
const expirationTime = root.finishedExpirationTime;
|
||||
if (finishedWork === null) {
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logCommitStopped();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
root.finishedWork = null;
|
||||
@@ -2112,12 +2039,6 @@ function commitRootImpl(root, renderPriorityLevel) {
|
||||
}
|
||||
|
||||
if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logCommitStopped();
|
||||
}
|
||||
}
|
||||
|
||||
// This is a legacy edge case. We just committed the initial mount of
|
||||
// a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
|
||||
// synchronously, but layout updates should be deferred until the end
|
||||
@@ -2128,12 +2049,6 @@ function commitRootImpl(root, renderPriorityLevel) {
|
||||
// If layout work was scheduled, flush it now.
|
||||
flushSyncCallbackQueue();
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logCommitStopped();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2249,14 +2164,6 @@ function commitLayoutEffects(
|
||||
root: FiberRoot,
|
||||
committedExpirationTime: ExpirationTime,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
const priorityLevel = getCurrentPriorityLevel();
|
||||
const label = priorityLevelToLabel(priorityLevel);
|
||||
logLayoutEffectsStarted(label);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Should probably move the bulk of this function to commitWork.
|
||||
while (nextEffect !== null) {
|
||||
setCurrentDebugFiberInDEV(nextEffect);
|
||||
@@ -2280,12 +2187,6 @@ function commitLayoutEffects(
|
||||
resetCurrentDebugFiberInDEV();
|
||||
nextEffect = nextEffect.nextEffect;
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logLayoutEffectsStopped();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function flushPassiveEffects() {
|
||||
@@ -2373,14 +2274,6 @@ function flushPassiveEffectsImpl() {
|
||||
'Cannot flush passive effects while already rendering.',
|
||||
);
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
const priorityLevel = getCurrentPriorityLevel();
|
||||
const label = priorityLevelToLabel(priorityLevel);
|
||||
logPassiveEffectsStarted(label);
|
||||
}
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
isFlushingPassiveEffects = true;
|
||||
}
|
||||
@@ -2559,12 +2452,6 @@ function flushPassiveEffectsImpl() {
|
||||
isFlushingPassiveEffects = false;
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (enableDebugTracing) {
|
||||
logPassiveEffectsStopped();
|
||||
}
|
||||
}
|
||||
|
||||
executionContext = prevExecutionContext;
|
||||
|
||||
flushSyncCallbackQueue();
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
import type {Fiber} from './ReactInternalTypes';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.new';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import type {ReactPriorityLevel} from './ReactInternalTypes';
|
||||
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime.new';
|
||||
import {
|
||||
@@ -105,7 +104,6 @@ import {
|
||||
} from './ReactFiberWorkLoop.new';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration.new';
|
||||
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
|
||||
@@ -121,9 +119,6 @@ export type Update<State> = {|
|
||||
callback: (() => mixed) | null,
|
||||
|
||||
next: Update<State> | null,
|
||||
|
||||
// DEV only
|
||||
priority?: ReactPriorityLevel,
|
||||
|};
|
||||
|
||||
type SharedQueue<State> = {|
|
||||
@@ -207,9 +202,6 @@ export function createUpdate(
|
||||
|
||||
next: null,
|
||||
};
|
||||
if (__DEV__) {
|
||||
update.priority = getCurrentPriorityLevel();
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export const disableInputAttributeSyncing = __VARIANT__;
|
||||
export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
|
||||
export const enableModernEventSystem = __VARIANT__;
|
||||
export const enableLegacyFBSupport = __VARIANT__;
|
||||
export const enableDebugTracing = __VARIANT__;
|
||||
export const enableDebugTracing = !__VARIANT__;
|
||||
|
||||
// These are already tested in both modes using the build type dimension,
|
||||
// so we don't need to use __VARIANT__ to get extra coverage.
|
||||
|
||||
Reference in New Issue
Block a user