@@ -12,7 +12,6 @@ import type {
1212 MutableSourceGetSnapshotFn ,
1313 MutableSourceSubscribeFn ,
1414 ReactContext ,
15- ReactCache ,
1615} from 'shared/ReactTypes' ;
1716import type { Fiber , Dispatcher , HookType } from './ReactInternalTypes' ;
1817import type { Lanes , Lane } from './ReactFiberLane' ;
@@ -1816,12 +1815,12 @@ function dispatchAction<S, A>(
18161815 }
18171816}
18181817
1819- function readCache ( ) {
1818+ function getCacheForType < T > (resourceType: () = > T ) : T {
18201819 invariant ( false , 'Not implemented.' ) ;
18211820}
18221821
18231822export const ContextOnlyDispatcher: Dispatcher = {
1824- readCache ,
1823+ getCacheForType ,
18251824 readContext ,
18261825
18271826 useCallback : throwInvalidHookError ,
@@ -1843,7 +1842,7 @@ export const ContextOnlyDispatcher: Dispatcher = {
18431842} ;
18441843
18451844const HooksDispatcherOnMount: Dispatcher = {
1846- readCache ,
1845+ getCacheForType ,
18471846 readContext ,
18481847
18491848 useCallback : mountCallback ,
@@ -1865,7 +1864,7 @@ const HooksDispatcherOnMount: Dispatcher = {
18651864} ;
18661865
18671866const HooksDispatcherOnUpdate: Dispatcher = {
1868- readCache ,
1867+ getCacheForType ,
18691868 readContext ,
18701869
18711870 useCallback : updateCallback ,
@@ -1887,7 +1886,7 @@ const HooksDispatcherOnUpdate: Dispatcher = {
18871886} ;
18881887
18891888const HooksDispatcherOnRerender: Dispatcher = {
1890- readCache ,
1889+ getCacheForType ,
18911890 readContext ,
18921891
18931892 useCallback : updateCallback ,
@@ -1936,8 +1935,8 @@ if (__DEV__) {
19361935 } ;
19371936
19381937 HooksDispatcherOnMountInDEV = {
1939- readCache ( ) : ReactCache {
1940- return readCache ( ) ;
1938+ getCacheForType < T > ( resourceType : ( ) => T ) : T {
1939+ return getCacheForType ( resourceType ) ;
19411940 } ,
19421941 readContext < T > (
19431942 context : ReactContext < T > ,
@@ -2066,8 +2065,8 @@ if (__DEV__) {
20662065 } ;
20672066
20682067 HooksDispatcherOnMountWithHookTypesInDEV = {
2069- readCache ( ) : ReactCache {
2070- return readCache ( ) ;
2068+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2069+ return getCacheForType ( resourceType ) ;
20712070 } ,
20722071 readContext < T > (
20732072 context : ReactContext < T > ,
@@ -2191,8 +2190,8 @@ if (__DEV__) {
21912190 } ;
21922191
21932192 HooksDispatcherOnUpdateInDEV = {
2194- readCache ( ) : ReactCache {
2195- return readCache ( ) ;
2193+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2194+ return getCacheForType ( resourceType ) ;
21962195 } ,
21972196 readContext < T > (
21982197 context : ReactContext < T > ,
@@ -2316,8 +2315,8 @@ if (__DEV__) {
23162315 } ;
23172316
23182317 HooksDispatcherOnRerenderInDEV = {
2319- readCache ( ) : ReactCache {
2320- return readCache ( ) ;
2318+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2319+ return getCacheForType ( resourceType ) ;
23212320 } ,
23222321 readContext < T > (
23232322 context : ReactContext < T > ,
@@ -2442,8 +2441,8 @@ if (__DEV__) {
24422441 } ;
24432442
24442443 InvalidNestedHooksDispatcherOnMountInDEV = {
2445- readCache ( ) : ReactCache {
2446- return readCache ( ) ;
2444+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2445+ return getCacheForType ( resourceType ) ;
24472446 } ,
24482447 readContext < T > (
24492448 context : ReactContext < T > ,
@@ -2582,8 +2581,8 @@ if (__DEV__) {
25822581 } ;
25832582
25842583 InvalidNestedHooksDispatcherOnUpdateInDEV = {
2585- readCache ( ) : ReactCache {
2586- return readCache ( ) ;
2584+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2585+ return getCacheForType ( resourceType ) ;
25872586 } ,
25882587 readContext < T > (
25892588 context : ReactContext < T > ,
@@ -2722,8 +2721,8 @@ if (__DEV__) {
27222721 } ;
27232722
27242723 InvalidNestedHooksDispatcherOnRerenderInDEV = {
2725- readCache ( ) : ReactCache {
2726- return readCache ( ) ;
2724+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2725+ return getCacheForType ( resourceType ) ;
27272726 } ,
27282727 readContext < T > (
27292728 context : ReactContext < T > ,
0 commit comments