Skip to content

Commit

Permalink
Added additional DEBUG logging to hook names cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jul 7, 2021
1 parent 7b423be commit c4e3620
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/react-devtools-shared/src/hookNamesCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import {unstable_getCacheForType as getCacheForType} from 'react';
import {enableHookNameParsing} from 'react-devtools-feature-flags';
import {__DEBUG__} from 'react-devtools-shared/src/constants';

import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
import type {Thenable, Wakeable} from 'shared/ReactTypes';
Expand Down Expand Up @@ -108,6 +109,10 @@ export function loadHookNames(
return;
}

if (__DEBUG__) {
console.log('[hookNamesCache] onSuccess() hookNames:', hookNames);
}

if (hookNames) {
const resolvedRecord = ((newRecord: any): ResolvedRecord<HookNames>);
resolvedRecord.status = Resolved;
Expand All @@ -121,6 +126,10 @@ export function loadHookNames(
wake();
},
function onError(error) {
if (__DEBUG__) {
console.log('[hookNamesCache] onError() error:', error);
}

if (didTimeout) {
return;
}
Expand All @@ -134,7 +143,11 @@ export function loadHookNames(
);

// Eventually timeout and stop trying to load names.
let timeoutID = setTimeout(() => {
let timeoutID = setTimeout(function onTimeout() {
if (__DEBUG__) {
console.log('[hookNamesCache] onTimeout()');
}

timeoutID = null;

didTimeout = true;
Expand Down

0 comments on commit c4e3620

Please sign in to comment.