Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,10 @@ export function createHostRootFiber(
mode = NoMode;
}

if (enableProfilerTimer && isDevToolsPresent) {
// Always collect profile timings when DevTools are present.
// This enables DevTools to start capturing timing at any point–
// Without some nodes in the tree having empty base times.
if (__DEV__ || (enableProfilerTimer && isDevToolsPresent)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a breaking change but my preference would be that this is only on for DEV and not if isDevToolsPresent. Since otherwise if I have a profiling build and I have devtools installed, but my colleague doesn't, it can be confusing why it doesn't work. Whereas if it's always <Profiler> that opt-in to profiling builds then I'd have to add it and then my colleague would see it too.

// dev: Enable profiling instrumentation by default.
// profile: enabled if DevTools is present or subtree is wrapped in <Profiler>.
// production: disabled.
mode |= ProfileMode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe(`onRender`, () => {
expect(callback).toHaveBeenCalledTimes(1);
});

// @gate !__DEV__
it('does not record times for components outside of Profiler tree', async () => {
// Mock the Scheduler module so we can track how many times the current
// time is read
Expand Down
Loading