@@ -73,6 +73,10 @@ function getPrimitiveStackCache(): Map<string, Array<any>> {
7373 Dispatcher . useState ( null ) ;
7474 Dispatcher . useReducer ( ( s , a ) => s , null ) ;
7575 Dispatcher . useRef ( null ) ;
76+ if ( typeof Dispatcher . useCacheRefresh === 'function' ) {
77+ // This type check is for Flow only.
78+ Dispatcher . useCacheRefresh ( ) ;
79+ }
7680 Dispatcher . useLayoutEffect ( ( ) => { } ) ;
7781 Dispatcher . useEffect ( ( ) => { } ) ;
7882 Dispatcher . useImperativeHandle ( undefined , ( ) => null ) ;
@@ -171,6 +175,16 @@ function useRef<T>(initialValue: T): {|current: T|} {
171175 return ref ;
172176}
173177
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+
174188function useLayoutEffect(
175189 create: () => ( ( ) => void ) | void ,
176190 inputs : Array < mixed > | void | null,
@@ -305,6 +319,7 @@ function useOpaqueIdentifier(): OpaqueIDType | void {
305319const Dispatcher : DispatcherType = {
306320 getCacheForType ,
307321 readContext ,
322+ useCacheRefresh ,
308323 useCallback ,
309324 useContext ,
310325 useEffect ,
0 commit comments