File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
packages/react-devtools-shared/src Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,18 @@ export function loadHookNames(
8282 callbacks . add ( callback ) ;
8383 } ,
8484 } ;
85+
8586 const wake = ( ) => {
87+ if ( timeoutID ) {
88+ clearTimeout ( timeoutID ) ;
89+ timeoutID = null ;
90+ }
91+
8692 // This assumes they won't throw.
8793 callbacks . forEach ( callback => callback ( ) ) ;
8894 callbacks . clear ( ) ;
8995 } ;
96+
9097 const newRecord : Record < HookNames > = ( record = {
9198 status : Pending ,
9299 value : wakeable ,
@@ -113,6 +120,10 @@ export function loadHookNames(
113120 wake ( ) ;
114121 } ,
115122 function onError ( error ) {
123+ if ( didTimeout ) {
124+ return ;
125+ }
126+
116127 const thrownRecord = ( ( newRecord : any ) : RejectedRecord ) ;
117128 thrownRecord . status = Rejected ;
118129 thrownRecord . value = null ;
@@ -122,7 +133,9 @@ export function loadHookNames(
122133 ) ;
123134
124135 // Eventually timeout and stop trying to load names.
125- setTimeout ( ( ) => {
136+ let timeoutID = setTimeout ( ( ) => {
137+ timeoutID = null ;
138+
126139 didTimeout = true ;
127140
128141 const timedoutRecord = ( ( newRecord : any ) : RejectedRecord ) ;
You can’t perform that action at this time.
0 commit comments