Skip to content

Commit

Permalink
Remove execution context check from shouldProfile (#30971)
Browse files Browse the repository at this point in the history
I don't know why this is here since all these callsites are within the
CommitWork/CommitEffects helpers.

This should help with inlining.
  • Loading branch information
sebmarkbage committed Sep 16, 2024
1 parent d7167c3 commit 8152e5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
8 changes: 2 additions & 6 deletions packages/react-reconciler/src/ReactFiberCommitEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ import {getPublicInstance} from './ReactFiberConfig';
import {
captureCommitPhaseError,
setIsRunningInsertionEffect,
getExecutionContext,
CommitContext,
NoContext,
} from './ReactFiberWorkLoop';
import {
NoFlags as NoHookEffect,
Expand Down Expand Up @@ -81,8 +78,7 @@ function shouldProfile(current: Fiber): boolean {
return (
enableProfilerTimer &&
enableProfilerCommitHooks &&
(current.mode & ProfileMode) !== NoMode &&
(getExecutionContext() & CommitContext) !== NoContext
(current.mode & ProfileMode) !== NoMode
);
}

Expand Down Expand Up @@ -919,7 +915,7 @@ export function commitProfilerUpdate(
commitTime: number,
effectDuration: number,
) {
if (enableProfilerTimer && getExecutionContext() & CommitContext) {
if (enableProfilerTimer) {
try {
if (__DEV__) {
runWithFiberInDEV(
Expand Down
12 changes: 2 additions & 10 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ import {
addMarkerProgressCallbackToPendingTransition,
addMarkerIncompleteCallbackToPendingTransition,
addMarkerCompleteCallbackToPendingTransition,
getExecutionContext,
CommitContext,
NoContext,
setIsRunningInsertionEffect,
} from './ReactFiberWorkLoop';
import {
Expand Down Expand Up @@ -233,8 +230,7 @@ function shouldProfile(current: Fiber): boolean {
return (
enableProfilerTimer &&
enableProfilerCommitHooks &&
(current.mode & ProfileMode) !== NoMode &&
(getExecutionContext() & CommitContext) !== NoContext
(current.mode & ProfileMode) !== NoMode
);
}

Expand Down Expand Up @@ -2817,11 +2813,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(
Expand Down

0 comments on commit 8152e5c

Please sign in to comment.