File tree 1 file changed +15
-0
lines changed
packages/react-debug-tools/src 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ function getPrimitiveStackCache(): Map<string, Array<any>> {
73
73
Dispatcher . useState ( null ) ;
74
74
Dispatcher . useReducer ( ( s , a ) => s , null ) ;
75
75
Dispatcher . useRef ( null ) ;
76
+ if ( typeof Dispatcher . useRefresh === 'function' ) {
77
+ // This type check is for Flow only.
78
+ Dispatcher . useRefresh ( ) ;
79
+ }
76
80
Dispatcher . useLayoutEffect ( ( ) => { } ) ;
77
81
Dispatcher . useEffect ( ( ) => { } ) ;
78
82
Dispatcher . useImperativeHandle ( undefined , ( ) => null ) ;
@@ -171,6 +175,16 @@ function useRef<T>(initialValue: T): {|current: T|} {
171
175
return ref ;
172
176
}
173
177
178
+ function useRefresh(): () => void {
179
+ const hook = nextHook ( ) ;
180
+ hookLog . push ( {
181
+ primitive : 'Refresh' ,
182
+ stackError : new Error ( ) ,
183
+ value : hook !== null ? hook . memoizedState [ 0 ] : function refresh ( ) { } ,
184
+ } ) ;
185
+ return ( ) = > { } ;
186
+ }
187
+
174
188
function useLayoutEffect(
175
189
create: () => ( ( ) => void ) | void ,
176
190
inputs : Array < mixed > | void | null,
@@ -314,6 +328,7 @@ const Dispatcher: DispatcherType = {
314
328
useMemo ,
315
329
useReducer ,
316
330
useRef ,
331
+ useRefresh ,
317
332
useState ,
318
333
useTransition ,
319
334
useMutableSource ,
You can’t perform that action at this time.
0 commit comments