From fa9feb48fc7912bdb7607c8ac2ad729244df79da Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Mon, 16 Sep 2024 12:58:47 -0400 Subject: [PATCH 1/2] Remove execution context check from shouldProfile I don't know why this is here since all these callsites are within the CommitWork/CommitEffects helpers. Should help inline this. --- packages/react-reconciler/src/ReactFiberCommitEffects.js | 4 +--- packages/react-reconciler/src/ReactFiberCommitWork.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitEffects.js b/packages/react-reconciler/src/ReactFiberCommitEffects.js index af5762df2110a..1b9106d8d901e 100644 --- a/packages/react-reconciler/src/ReactFiberCommitEffects.js +++ b/packages/react-reconciler/src/ReactFiberCommitEffects.js @@ -48,7 +48,6 @@ import { setIsRunningInsertionEffect, getExecutionContext, CommitContext, - NoContext, } from './ReactFiberWorkLoop'; import { NoFlags as NoHookEffect, @@ -81,8 +80,7 @@ function shouldProfile(current: Fiber): boolean { return ( enableProfilerTimer && enableProfilerCommitHooks && - (current.mode & ProfileMode) !== NoMode && - (getExecutionContext() & CommitContext) !== NoContext + (current.mode & ProfileMode) !== NoMode ); } diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index bb37628c2d7a7..c2b1fc55e9b7d 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -144,7 +144,6 @@ import { addMarkerCompleteCallbackToPendingTransition, getExecutionContext, CommitContext, - NoContext, setIsRunningInsertionEffect, } from './ReactFiberWorkLoop'; import { @@ -230,8 +229,7 @@ function shouldProfile(current: Fiber): boolean { return ( enableProfilerTimer && enableProfilerCommitHooks && - (current.mode & ProfileMode) !== NoMode && - (getExecutionContext() & CommitContext) !== NoContext + (current.mode & ProfileMode) !== NoMode ); } From a17fd6fb617f561b78e148b9ad9b9f03f1d18a2a Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Mon, 16 Sep 2024 13:55:36 -0400 Subject: [PATCH 2/2] Two more --- packages/react-reconciler/src/ReactFiberCommitEffects.js | 4 +--- packages/react-reconciler/src/ReactFiberCommitWork.js | 8 +------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitEffects.js b/packages/react-reconciler/src/ReactFiberCommitEffects.js index 1b9106d8d901e..dde2479ba8638 100644 --- a/packages/react-reconciler/src/ReactFiberCommitEffects.js +++ b/packages/react-reconciler/src/ReactFiberCommitEffects.js @@ -46,8 +46,6 @@ import {getPublicInstance} from './ReactFiberConfig'; import { captureCommitPhaseError, setIsRunningInsertionEffect, - getExecutionContext, - CommitContext, } from './ReactFiberWorkLoop'; import { NoFlags as NoHookEffect, @@ -917,7 +915,7 @@ export function commitProfilerUpdate( commitTime: number, effectDuration: number, ) { - if (enableProfilerTimer && getExecutionContext() & CommitContext) { + if (enableProfilerTimer) { try { if (__DEV__) { runWithFiberInDEV( diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index c2b1fc55e9b7d..21c37d723a404 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -142,8 +142,6 @@ import { addMarkerProgressCallbackToPendingTransition, addMarkerIncompleteCallbackToPendingTransition, addMarkerCompleteCallbackToPendingTransition, - getExecutionContext, - CommitContext, setIsRunningInsertionEffect, } from './ReactFiberWorkLoop'; import { @@ -2764,11 +2762,7 @@ function commitPassiveMountOnFiber( // Only Profilers with work in their subtree will have a Passive effect scheduled. if (flags & Passive) { - if ( - enableProfilerTimer && - enableProfilerCommitHooks && - getExecutionContext() & CommitContext - ) { + if (enableProfilerTimer && enableProfilerCommitHooks) { const {passiveEffectDuration} = finishedWork.stateNode; commitProfilerPostCommit(