@@ -1987,7 +1987,7 @@ function rerenderState<S>(
19871987 return rerenderReducer ( basicStateReducer , initialState ) ;
19881988}
19891989
1990- function mountOptimisticState < S , A > (
1990+ function mountOptimistic < S , A > (
19911991 passthrough: S,
19921992 reducer: ?(S, A) => S ,
19931993) : [ S , ( A ) => void ] {
@@ -2013,7 +2013,7 @@ function mountOptimisticState<S, A>(
20132013 return [ passthrough , dispatch ] ;
20142014}
20152015
2016- function updateOptimisticState < S , A > (
2016+ function updateOptimistic < S , A > (
20172017 passthrough: S,
20182018 reducer: ?(S, A) => S ,
20192019) : [ S , ( A ) => void ] {
@@ -2034,11 +2034,11 @@ function updateOptimisticState<S, A>(
20342034 return updateReducerImpl ( hook , ( ( currentHook : any ) : Hook ) , resolvedReducer ) ;
20352035}
20362036
2037- function rerenderOptimisticState < S , A > (
2037+ function rerenderOptimistic < S , A > (
20382038 passthrough: S,
20392039 reducer: ?(S, A) => S ,
20402040) : [ S , ( A ) => void ] {
2041- // Unlike useState, useOptimisticState doesn't support render phase updates.
2041+ // Unlike useState, useOptimistic doesn't support render phase updates.
20422042 // Also unlike useState, we need to replay all pending updates again in case
20432043 // the passthrough value changed.
20442044 //
@@ -2048,7 +2048,7 @@ function rerenderOptimisticState<S, A>(
20482048
20492049 if ( currentHook !== null ) {
20502050 // This is an update. Process the update queue.
2051- return updateOptimisticState ( passthrough , reducer ) ;
2051+ return updateOptimistic ( passthrough , reducer ) ;
20522052 }
20532053
20542054 // This is a mount. No updates to process.
@@ -3207,8 +3207,7 @@ if (enableFormActions && enableAsyncActions) {
32073207 throwInvalidHookError ;
32083208}
32093209if (enableAsyncActions) {
3210- ( ContextOnlyDispatcher : Dispatcher ) . useOptimisticState =
3211- throwInvalidHookError ;
3210+ ( ContextOnlyDispatcher : Dispatcher ) . useOptimistic = throwInvalidHookError ;
32123211}
32133212
32143213const HooksDispatcherOnMount: Dispatcher = {
@@ -3246,8 +3245,7 @@ if (enableFormActions && enableAsyncActions) {
32463245 useHostTransitionStatus ;
32473246}
32483247if (enableAsyncActions) {
3249- ( HooksDispatcherOnMount : Dispatcher ) . useOptimisticState =
3250- mountOptimisticState ;
3248+ ( HooksDispatcherOnMount : Dispatcher ) . useOptimistic = mountOptimistic ;
32513249}
32523250
32533251const HooksDispatcherOnUpdate: Dispatcher = {
@@ -3285,8 +3283,7 @@ if (enableFormActions && enableAsyncActions) {
32853283 useHostTransitionStatus ;
32863284}
32873285if (enableAsyncActions) {
3288- ( HooksDispatcherOnUpdate : Dispatcher ) . useOptimisticState =
3289- updateOptimisticState ;
3286+ ( HooksDispatcherOnUpdate : Dispatcher ) . useOptimistic = updateOptimistic ;
32903287}
32913288
32923289const HooksDispatcherOnRerender: Dispatcher = {
@@ -3324,8 +3321,7 @@ if (enableFormActions && enableAsyncActions) {
33243321 useHostTransitionStatus ;
33253322}
33263323if (enableAsyncActions) {
3327- ( HooksDispatcherOnRerender : Dispatcher ) . useOptimisticState =
3328- rerenderOptimisticState ;
3324+ ( HooksDispatcherOnRerender : Dispatcher ) . useOptimistic = rerenderOptimistic ;
33293325}
33303326
33313327let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
@@ -3518,14 +3514,14 @@ if (__DEV__) {
35183514 useHostTransitionStatus ;
35193515 }
35203516 if (enableAsyncActions) {
3521- ( HooksDispatcherOnMountInDEV : Dispatcher ) . useOptimisticState =
3522- function useOptimisticState < S , A > (
3517+ ( HooksDispatcherOnMountInDEV : Dispatcher ) . useOptimistic =
3518+ function useOptimistic < S , A > (
35233519 passthrough : S ,
35243520 reducer : ?( S , A ) = > S ,
35253521 ) : [ S , ( A ) => void ] {
3526- currentHookNameInDev = 'useOptimisticState ' ;
3522+ currentHookNameInDev = 'useOptimistic ' ;
35273523 mountHookTypesDev ( ) ;
3528- return mountOptimisticState ( passthrough , reducer ) ;
3524+ return mountOptimistic ( passthrough , reducer ) ;
35293525 } ;
35303526 }
35313527
@@ -3687,14 +3683,14 @@ if (__DEV__) {
36873683 useHostTransitionStatus ;
36883684 }
36893685 if (enableAsyncActions) {
3690- ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . useOptimisticState =
3691- function useOptimisticState < S , A > (
3686+ ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . useOptimistic =
3687+ function useOptimistic < S , A > (
36923688 passthrough : S ,
36933689 reducer : ?( S , A ) = > S ,
36943690 ) : [ S , ( A ) => void ] {
3695- currentHookNameInDev = 'useOptimisticState ' ;
3691+ currentHookNameInDev = 'useOptimistic ' ;
36963692 updateHookTypesDev ( ) ;
3697- return mountOptimisticState ( passthrough , reducer ) ;
3693+ return mountOptimistic ( passthrough , reducer ) ;
36983694 } ;
36993695 }
37003696
@@ -3858,14 +3854,14 @@ if (__DEV__) {
38583854 useHostTransitionStatus ;
38593855 }
38603856 if (enableAsyncActions) {
3861- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . useOptimisticState =
3862- function useOptimisticState < S , A > (
3857+ ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . useOptimistic =
3858+ function useOptimistic < S , A > (
38633859 passthrough : S ,
38643860 reducer : ?( S , A ) = > S ,
38653861 ) : [ S , ( A ) => void ] {
3866- currentHookNameInDev = 'useOptimisticState ' ;
3862+ currentHookNameInDev = 'useOptimistic ' ;
38673863 updateHookTypesDev ( ) ;
3868- return updateOptimisticState ( passthrough , reducer ) ;
3864+ return updateOptimistic ( passthrough , reducer ) ;
38693865 } ;
38703866 }
38713867
@@ -4029,14 +4025,14 @@ if (__DEV__) {
40294025 useHostTransitionStatus ;
40304026 }
40314027 if (enableAsyncActions) {
4032- ( HooksDispatcherOnRerenderInDEV : Dispatcher ) . useOptimisticState =
4033- function useOptimisticState < S , A > (
4028+ ( HooksDispatcherOnRerenderInDEV : Dispatcher ) . useOptimistic =
4029+ function useOptimistic < S , A > (
40344030 passthrough : S ,
40354031 reducer : ?( S , A ) = > S ,
40364032 ) : [ S , ( A ) => void ] {
4037- currentHookNameInDev = 'useOptimisticState ' ;
4033+ currentHookNameInDev = 'useOptimistic ' ;
40384034 updateHookTypesDev ( ) ;
4039- return rerenderOptimisticState ( passthrough , reducer ) ;
4035+ return rerenderOptimistic ( passthrough , reducer ) ;
40404036 } ;
40414037 }
40424038
@@ -4222,15 +4218,15 @@ if (__DEV__) {
42224218 useHostTransitionStatus ;
42234219 }
42244220 if (enableAsyncActions) {
4225- ( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . useOptimisticState =
4226- function useOptimisticState < S , A > (
4221+ ( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . useOptimistic =
4222+ function useOptimistic < S , A > (
42274223 passthrough : S ,
42284224 reducer : ?( S , A ) = > S ,
42294225 ) : [ S , ( A ) => void ] {
4230- currentHookNameInDev = 'useOptimisticState ' ;
4226+ currentHookNameInDev = 'useOptimistic ' ;
42314227 warnInvalidHookAccess ( ) ;
42324228 mountHookTypesDev ( ) ;
4233- return mountOptimisticState ( passthrough , reducer ) ;
4229+ return mountOptimistic ( passthrough , reducer ) ;
42344230 } ;
42354231 }
42364232
@@ -4419,15 +4415,15 @@ if (__DEV__) {
44194415 useHostTransitionStatus ;
44204416 }
44214417 if (enableAsyncActions) {
4422- ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . useOptimisticState =
4423- function useOptimisticState < S , A > (
4418+ ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . useOptimistic =
4419+ function useOptimistic < S , A > (
44244420 passthrough : S ,
44254421 reducer : ?( S , A ) = > S ,
44264422 ) : [ S , ( A ) => void ] {
4427- currentHookNameInDev = 'useOptimisticState ' ;
4423+ currentHookNameInDev = 'useOptimistic ' ;
44284424 warnInvalidHookAccess ( ) ;
44294425 updateHookTypesDev ( ) ;
4430- return updateOptimisticState ( passthrough , reducer ) ;
4426+ return updateOptimistic ( passthrough , reducer ) ;
44314427 } ;
44324428 }
44334429
@@ -4616,15 +4612,15 @@ if (__DEV__) {
46164612 useHostTransitionStatus ;
46174613 }
46184614 if (enableAsyncActions) {
4619- ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . useOptimisticState =
4620- function useOptimisticState < S , A > (
4615+ ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . useOptimistic =
4616+ function useOptimistic < S , A > (
46214617 passthrough : S ,
46224618 reducer : ?( S , A ) = > S ,
46234619 ) : [ S , ( A ) => void ] {
4624- currentHookNameInDev = 'useOptimisticState ' ;
4620+ currentHookNameInDev = 'useOptimistic ' ;
46254621 warnInvalidHookAccess ( ) ;
46264622 updateHookTypesDev ( ) ;
4627- return rerenderOptimisticState ( passthrough , reducer ) ;
4623+ return rerenderOptimistic ( passthrough , reducer ) ;
46284624 } ;
46294625 }
46304626}
0 commit comments