File tree 1 file changed +14
-1
lines changed
packages/react-devtools-shared/src 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,18 @@ export function loadHookNames(
82
82
callbacks . add ( callback ) ;
83
83
} ,
84
84
} ;
85
+
85
86
const wake = ( ) => {
87
+ if ( timeoutID ) {
88
+ clearTimeout ( timeoutID ) ;
89
+ timeoutID = null ;
90
+ }
91
+
86
92
// This assumes they won't throw.
87
93
callbacks . forEach ( callback => callback ( ) ) ;
88
94
callbacks . clear ( ) ;
89
95
} ;
96
+
90
97
const newRecord : Record < HookNames > = ( record = {
91
98
status : Pending ,
92
99
value : wakeable ,
@@ -113,6 +120,10 @@ export function loadHookNames(
113
120
wake ( ) ;
114
121
} ,
115
122
function onError ( error ) {
123
+ if ( didTimeout ) {
124
+ return ;
125
+ }
126
+
116
127
const thrownRecord = ( ( newRecord : any ) : RejectedRecord ) ;
117
128
thrownRecord . status = Rejected ;
118
129
thrownRecord . value = null ;
@@ -122,7 +133,9 @@ export function loadHookNames(
122
133
) ;
123
134
124
135
// Eventually timeout and stop trying to load names.
125
- setTimeout ( ( ) => {
136
+ let timeoutID = setTimeout ( ( ) => {
137
+ timeoutID = null ;
138
+
126
139
didTimeout = true ;
127
140
128
141
const timedoutRecord = ( ( newRecord : any ) : RejectedRecord ) ;
You can’t perform that action at this time.
0 commit comments