Skip to content

Commit c4e3620

Browse files
author
Brian Vaughn
committed
Added additional DEBUG logging to hook names cache
1 parent 7b423be commit c4e3620

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/react-devtools-shared/src/hookNamesCache.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

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

1314
import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
1415
import type {Thenable, Wakeable} from 'shared/ReactTypes';
@@ -108,6 +109,10 @@ export function loadHookNames(
108109
return;
109110
}
110111

112+
if (__DEBUG__) {
113+
console.log('[hookNamesCache] onSuccess() hookNames:', hookNames);
114+
}
115+
111116
if (hookNames) {
112117
const resolvedRecord = ((newRecord: any): ResolvedRecord<HookNames>);
113118
resolvedRecord.status = Resolved;
@@ -121,6 +126,10 @@ export function loadHookNames(
121126
wake();
122127
},
123128
function onError(error) {
129+
if (__DEBUG__) {
130+
console.log('[hookNamesCache] onError() error:', error);
131+
}
132+
124133
if (didTimeout) {
125134
return;
126135
}
@@ -134,7 +143,11 @@ export function loadHookNames(
134143
);
135144

136145
// Eventually timeout and stop trying to load names.
137-
let timeoutID = setTimeout(() => {
146+
let timeoutID = setTimeout(function onTimeout() {
147+
if (__DEBUG__) {
148+
console.log('[hookNamesCache] onTimeout()');
149+
}
150+
138151
timeoutID = null;
139152

140153
didTimeout = true;

0 commit comments

Comments
 (0)