@@ -26,7 +26,6 @@ import type {
26
26
import type { Lanes , Lane } from './ReactFiberLane.new' ;
27
27
import type { HookFlags } from './ReactHookEffectTags' ;
28
28
import type { FiberRoot } from './ReactInternalTypes' ;
29
- import type { Cache } from './ReactFiberCacheComponent.new' ;
30
29
import type { Flags } from './ReactFiberFlags' ;
31
30
32
31
import ReactSharedInternals from 'shared/ReactSharedInternals' ;
@@ -122,7 +121,7 @@ import {
122
121
} from './ReactMutableSource.new' ;
123
122
import { logStateUpdateScheduled } from './DebugTracing' ;
124
123
import { markStateUpdateScheduled } from './ReactFiberDevToolsHook.new' ;
125
- import { createCache , CacheContext } from './ReactFiberCacheComponent.new' ;
124
+ import { createCache } from './ReactFiberCacheComponent.new' ;
126
125
import {
127
126
createUpdate as createLegacyQueueUpdate ,
128
127
enqueueUpdate as enqueueLegacyQueueUpdate ,
@@ -2600,27 +2599,6 @@ function markUpdateInDevTools<A>(fiber, lane, action: A) {
2600
2599
}
2601
2600
}
2602
2601
2603
- function getCacheSignal(): AbortSignal {
2604
- if ( ! enableCache ) {
2605
- throw new Error ( 'Not implemented.' ) ;
2606
- }
2607
- const cache: Cache = readContext(CacheContext);
2608
- return cache.controller.signal;
2609
- }
2610
-
2611
- function getCacheForType < T > (resourceType: () => T ) : T {
2612
- if ( ! enableCache ) {
2613
- throw new Error ( 'Not implemented.' ) ;
2614
- }
2615
- const cache: Cache = readContext(CacheContext);
2616
- let cacheForType: T | void = (cache.data.get(resourceType): any);
2617
- if (cacheForType === undefined) {
2618
- cacheForType = resourceType ( ) ;
2619
- cache . data . set ( resourceType , cacheForType ) ;
2620
- }
2621
- return cacheForType;
2622
- }
2623
-
2624
2602
export const ContextOnlyDispatcher: Dispatcher = {
2625
2603
readContext ,
2626
2604
@@ -2644,8 +2622,6 @@ export const ContextOnlyDispatcher: Dispatcher = {
2644
2622
unstable_isNewReconciler : enableNewReconciler ,
2645
2623
} ;
2646
2624
if (enableCache) {
2647
- ( ContextOnlyDispatcher : Dispatcher ) . getCacheSignal = getCacheSignal ;
2648
- ( ContextOnlyDispatcher : Dispatcher ) . getCacheForType = getCacheForType ;
2649
2625
( ContextOnlyDispatcher : Dispatcher ) . useCacheRefresh = throwInvalidHookError ;
2650
2626
}
2651
2627
if (enableUseHook) {
@@ -2681,8 +2657,6 @@ const HooksDispatcherOnMount: Dispatcher = {
2681
2657
unstable_isNewReconciler : enableNewReconciler ,
2682
2658
} ;
2683
2659
if (enableCache) {
2684
- ( HooksDispatcherOnMount : Dispatcher ) . getCacheSignal = getCacheSignal ;
2685
- ( HooksDispatcherOnMount : Dispatcher ) . getCacheForType = getCacheForType ;
2686
2660
// $FlowFixMe[escaped-generic] discovered when updating Flow
2687
2661
( HooksDispatcherOnMount : Dispatcher ) . useCacheRefresh = mountRefresh ;
2688
2662
}
@@ -2718,8 +2692,6 @@ const HooksDispatcherOnUpdate: Dispatcher = {
2718
2692
unstable_isNewReconciler : enableNewReconciler ,
2719
2693
} ;
2720
2694
if (enableCache) {
2721
- ( HooksDispatcherOnUpdate : Dispatcher ) . getCacheSignal = getCacheSignal ;
2722
- ( HooksDispatcherOnUpdate : Dispatcher ) . getCacheForType = getCacheForType ;
2723
2695
( HooksDispatcherOnUpdate : Dispatcher ) . useCacheRefresh = updateRefresh ;
2724
2696
}
2725
2697
if (enableUseMemoCacheHook) {
@@ -2755,8 +2727,6 @@ const HooksDispatcherOnRerender: Dispatcher = {
2755
2727
unstable_isNewReconciler : enableNewReconciler ,
2756
2728
} ;
2757
2729
if (enableCache) {
2758
- ( HooksDispatcherOnRerender : Dispatcher ) . getCacheSignal = getCacheSignal ;
2759
- ( HooksDispatcherOnRerender : Dispatcher ) . getCacheForType = getCacheForType ;
2760
2730
( HooksDispatcherOnRerender : Dispatcher ) . useCacheRefresh = updateRefresh ;
2761
2731
}
2762
2732
if (enableUseHook) {
@@ -2935,8 +2905,6 @@ if (__DEV__) {
2935
2905
unstable_isNewReconciler: enableNewReconciler,
2936
2906
} ;
2937
2907
if ( enableCache ) {
2938
- ( HooksDispatcherOnMountInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
2939
- ( HooksDispatcherOnMountInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
2940
2908
( HooksDispatcherOnMountInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
2941
2909
currentHookNameInDev = 'useCacheRefresh' ;
2942
2910
mountHookTypesDev ( ) ;
@@ -3094,8 +3062,6 @@ if (__DEV__) {
3094
3062
unstable_isNewReconciler: enableNewReconciler,
3095
3063
} ;
3096
3064
if ( enableCache ) {
3097
- ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3098
- ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3099
3065
( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3100
3066
currentHookNameInDev = 'useCacheRefresh' ;
3101
3067
updateHookTypesDev ( ) ;
@@ -3253,8 +3219,6 @@ if (__DEV__) {
3253
3219
unstable_isNewReconciler: enableNewReconciler,
3254
3220
} ;
3255
3221
if ( enableCache ) {
3256
- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3257
- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3258
3222
( HooksDispatcherOnUpdateInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3259
3223
currentHookNameInDev = 'useCacheRefresh' ;
3260
3224
updateHookTypesDev ( ) ;
@@ -3413,8 +3377,6 @@ if (__DEV__) {
3413
3377
unstable_isNewReconciler: enableNewReconciler,
3414
3378
} ;
3415
3379
if ( enableCache ) {
3416
- ( HooksDispatcherOnRerenderInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3417
- ( HooksDispatcherOnRerenderInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3418
3380
( HooksDispatcherOnRerenderInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3419
3381
currentHookNameInDev = 'useCacheRefresh' ;
3420
3382
updateHookTypesDev ( ) ;
@@ -3589,8 +3551,6 @@ if (__DEV__) {
3589
3551
unstable_isNewReconciler: enableNewReconciler,
3590
3552
} ;
3591
3553
if ( enableCache ) {
3592
- ( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3593
- ( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3594
3554
( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3595
3555
currentHookNameInDev = 'useCacheRefresh' ;
3596
3556
mountHookTypesDev ( ) ;
@@ -3776,8 +3736,6 @@ if (__DEV__) {
3776
3736
unstable_isNewReconciler: enableNewReconciler,
3777
3737
} ;
3778
3738
if ( enableCache ) {
3779
- ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3780
- ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3781
3739
( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3782
3740
currentHookNameInDev = 'useCacheRefresh' ;
3783
3741
updateHookTypesDev ( ) ;
@@ -3964,8 +3922,6 @@ if (__DEV__) {
3964
3922
unstable_isNewReconciler: enableNewReconciler,
3965
3923
} ;
3966
3924
if ( enableCache ) {
3967
- ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . getCacheSignal = getCacheSignal ;
3968
- ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . getCacheForType = getCacheForType ;
3969
3925
( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . useCacheRefresh = function useCacheRefresh ( ) {
3970
3926
currentHookNameInDev = 'useCacheRefresh' ;
3971
3927
updateHookTypesDev ( ) ;
0 commit comments