@@ -12,7 +12,6 @@ import type {
12
12
MutableSourceGetSnapshotFn ,
13
13
MutableSourceSubscribeFn ,
14
14
ReactContext ,
15
- ReactCache ,
16
15
} from 'shared/ReactTypes' ;
17
16
import type { Fiber , Dispatcher , HookType } from './ReactInternalTypes' ;
18
17
import type { Lanes , Lane } from './ReactFiberLane' ;
@@ -1816,12 +1815,12 @@ function dispatchAction<S, A>(
1816
1815
}
1817
1816
}
1818
1817
1819
- function readCache ( ) {
1818
+ function getCacheForType < T > (resourceType: () = > T ) : T {
1820
1819
invariant ( false , 'Not implemented.' ) ;
1821
1820
}
1822
1821
1823
1822
export const ContextOnlyDispatcher: Dispatcher = {
1824
- readCache ,
1823
+ getCacheForType ,
1825
1824
readContext ,
1826
1825
1827
1826
useCallback : throwInvalidHookError ,
@@ -1843,7 +1842,7 @@ export const ContextOnlyDispatcher: Dispatcher = {
1843
1842
} ;
1844
1843
1845
1844
const HooksDispatcherOnMount: Dispatcher = {
1846
- readCache ,
1845
+ getCacheForType ,
1847
1846
readContext ,
1848
1847
1849
1848
useCallback : mountCallback ,
@@ -1865,7 +1864,7 @@ const HooksDispatcherOnMount: Dispatcher = {
1865
1864
} ;
1866
1865
1867
1866
const HooksDispatcherOnUpdate: Dispatcher = {
1868
- readCache ,
1867
+ getCacheForType ,
1869
1868
readContext ,
1870
1869
1871
1870
useCallback : updateCallback ,
@@ -1887,7 +1886,7 @@ const HooksDispatcherOnUpdate: Dispatcher = {
1887
1886
} ;
1888
1887
1889
1888
const HooksDispatcherOnRerender: Dispatcher = {
1890
- readCache ,
1889
+ getCacheForType ,
1891
1890
readContext ,
1892
1891
1893
1892
useCallback : updateCallback ,
@@ -1936,8 +1935,8 @@ if (__DEV__) {
1936
1935
} ;
1937
1936
1938
1937
HooksDispatcherOnMountInDEV = {
1939
- readCache ( ) : ReactCache {
1940
- return readCache ( ) ;
1938
+ getCacheForType < T > ( resourceType : ( ) => T ) : T {
1939
+ return getCacheForType ( resourceType ) ;
1941
1940
} ,
1942
1941
readContext < T > (
1943
1942
context : ReactContext < T > ,
@@ -2066,8 +2065,8 @@ if (__DEV__) {
2066
2065
} ;
2067
2066
2068
2067
HooksDispatcherOnMountWithHookTypesInDEV = {
2069
- readCache ( ) : ReactCache {
2070
- return readCache ( ) ;
2068
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2069
+ return getCacheForType ( resourceType ) ;
2071
2070
} ,
2072
2071
readContext < T > (
2073
2072
context : ReactContext < T > ,
@@ -2191,8 +2190,8 @@ if (__DEV__) {
2191
2190
} ;
2192
2191
2193
2192
HooksDispatcherOnUpdateInDEV = {
2194
- readCache ( ) : ReactCache {
2195
- return readCache ( ) ;
2193
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2194
+ return getCacheForType ( resourceType ) ;
2196
2195
} ,
2197
2196
readContext < T > (
2198
2197
context : ReactContext < T > ,
@@ -2316,8 +2315,8 @@ if (__DEV__) {
2316
2315
} ;
2317
2316
2318
2317
HooksDispatcherOnRerenderInDEV = {
2319
- readCache ( ) : ReactCache {
2320
- return readCache ( ) ;
2318
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2319
+ return getCacheForType ( resourceType ) ;
2321
2320
} ,
2322
2321
readContext < T > (
2323
2322
context : ReactContext < T > ,
@@ -2442,8 +2441,8 @@ if (__DEV__) {
2442
2441
} ;
2443
2442
2444
2443
InvalidNestedHooksDispatcherOnMountInDEV = {
2445
- readCache ( ) : ReactCache {
2446
- return readCache ( ) ;
2444
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2445
+ return getCacheForType ( resourceType ) ;
2447
2446
} ,
2448
2447
readContext < T > (
2449
2448
context : ReactContext < T > ,
@@ -2582,8 +2581,8 @@ if (__DEV__) {
2582
2581
} ;
2583
2582
2584
2583
InvalidNestedHooksDispatcherOnUpdateInDEV = {
2585
- readCache ( ) : ReactCache {
2586
- return readCache ( ) ;
2584
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2585
+ return getCacheForType ( resourceType ) ;
2587
2586
} ,
2588
2587
readContext < T > (
2589
2588
context : ReactContext < T > ,
@@ -2722,8 +2721,8 @@ if (__DEV__) {
2722
2721
} ;
2723
2722
2724
2723
InvalidNestedHooksDispatcherOnRerenderInDEV = {
2725
- readCache ( ) : ReactCache {
2726
- return readCache ( ) ;
2724
+ getCacheForType < T > ( resourceType : ( ) = > T ) : T {
2725
+ return getCacheForType ( resourceType ) ;
2727
2726
} ,
2728
2727
readContext < T > (
2729
2728
context : ReactContext < T > ,
0 commit comments