@@ -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 . useCacheRefresh === 'function' ) {
77
+ // This type check is for Flow only.
78
+ Dispatcher . useCacheRefresh ( ) ;
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 useCacheRefresh(): () => void {
179
+ const hook = nextHook ( ) ;
180
+ hookLog . push ( {
181
+ primitive : 'CacheRefresh' ,
182
+ stackError : new Error ( ) ,
183
+ value : hook !== null ? hook . memoizedState : function refresh ( ) { } ,
184
+ } ) ;
185
+ return ( ) = > { } ;
186
+ }
187
+
174
188
function useLayoutEffect(
175
189
create: () => ( ( ) => void ) | void ,
176
190
inputs : Array < mixed > | void | null,
@@ -305,6 +319,7 @@ function useOpaqueIdentifier(): OpaqueIDType | void {
305
319
const Dispatcher : DispatcherType = {
306
320
getCacheForType ,
307
321
readContext ,
322
+ useCacheRefresh ,
308
323
useCallback ,
309
324
useContext ,
310
325
useEffect ,
0 commit comments