Skip to content

Commit

Permalink
Pass inferred priority level to DevTools only in PROFILE mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed May 17, 2019
1 parent 9efeba9 commit e65faef
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/react-reconciler/src/ReactFiberDevToolsHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @flow
*/

import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
import {requestCurrentTime} from './ReactFiberScheduler';
import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime';

Expand Down Expand Up @@ -53,13 +54,17 @@ export function injectInternals(internals: Object): boolean {
const rendererID = hook.inject(internals);
// We have successfully injected, so now it is safe to set up hooks.
onCommitFiberRoot = (root, expirationTime) => {
const currentTime = requestCurrentTime();
const priorityLevel = inferPriorityFromExpirationTime(
currentTime,
expirationTime,
);
try {
hook.onCommitFiberRoot(rendererID, root, priorityLevel);
if (enableProfilerTimer) {
const currentTime = requestCurrentTime();
const priorityLevel = inferPriorityFromExpirationTime(
currentTime,
expirationTime,
);
hook.onCommitFiberRoot(rendererID, root, priorityLevel);
} else {
hook.onCommitFiberRoot(rendererID, root);
}
} catch (err) {
if (__DEV__ && !hasLoggedError) {
hasLoggedError = true;
Expand Down

0 comments on commit e65faef

Please sign in to comment.