Skip to content

Commit

Permalink
Don't inject timeline hooks unless React supports profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jan 20, 2022
1 parent 790b524 commit 9dcb541
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions packages/react-reconciler/src/ReactFiberDevToolsHook.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ export function injectInternals(internals: Object): boolean {
return true;
}
try {
rendererID = hook.inject({
...internals,
getLaneLabelMap,
injectProfilingHooks,
});
if (enableSchedulingProfiler) {
internals = {
...internals,
getLaneLabelMap,
injectProfilingHooks,
};
}

rendererID = hook.inject(internals);

// We have successfully injected, so now it is safe to set up hooks.
injectedHook = hook;
} catch (err) {
Expand Down
15 changes: 10 additions & 5 deletions packages/react-reconciler/src/ReactFiberDevToolsHook.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ export function injectInternals(internals: Object): boolean {
return true;
}
try {
rendererID = hook.inject({
...internals,
getLaneLabelMap,
injectProfilingHooks,
});
if (enableSchedulingProfiler) {
internals = {
...internals,
getLaneLabelMap,
injectProfilingHooks,
};
}

rendererID = hook.inject(internals);

// We have successfully injected, so now it is safe to set up hooks.
injectedHook = hook;
} catch (err) {
Expand Down

0 comments on commit 9dcb541

Please sign in to comment.