@@ -1835,6 +1835,37 @@ function rerenderOptimistic<S, A>(
1835
1835
return [ passthrough , dispatch ] ;
1836
1836
}
1837
1837
1838
+ function TODO_formStateDispatch ( ) {
1839
+ throw new Error ( 'Not implemented.' ) ;
1840
+ }
1841
+
1842
+ function mountFormState < S , P > (
1843
+ action : ( S , P ) = > S ,
1844
+ initialState : S ,
1845
+ url ? : string ,
1846
+ ) : [ S , ( P ) => void ] {
1847
+ // TODO: Not yet implemented
1848
+ return [ initialState , TODO_formStateDispatch ] ;
1849
+ }
1850
+
1851
+ function updateFormState < S , P > (
1852
+ action : ( S , P ) = > S ,
1853
+ initialState : S ,
1854
+ url ? : string ,
1855
+ ) : [ S , ( P ) => void ] {
1856
+ // TODO: Not yet implemented
1857
+ return [ initialState , TODO_formStateDispatch ] ;
1858
+ }
1859
+
1860
+ function rerenderFormState < S , P > (
1861
+ action : ( S , P ) = > S ,
1862
+ initialState : S ,
1863
+ url ? : string ,
1864
+ ) : [ S , ( P ) => void ] {
1865
+ // TODO: Not yet implemented
1866
+ return [ initialState , TODO_formStateDispatch ] ;
1867
+ }
1868
+
1838
1869
function pushEffect (
1839
1870
tag : HookFlags ,
1840
1871
create : ( ) = > ( ( ) => void ) | void ,
@@ -2984,6 +3015,7 @@ if (enableFormActions && enableAsyncActions) {
2984
3015
}
2985
3016
if (enableAsyncActions) {
2986
3017
( ContextOnlyDispatcher : Dispatcher ) . useOptimistic = throwInvalidHookError ;
3018
+ ( ContextOnlyDispatcher : Dispatcher ) . useFormState = throwInvalidHookError ;
2987
3019
}
2988
3020
2989
3021
const HooksDispatcherOnMount: Dispatcher = {
@@ -3021,6 +3053,7 @@ if (enableFormActions && enableAsyncActions) {
3021
3053
}
3022
3054
if (enableAsyncActions) {
3023
3055
( HooksDispatcherOnMount : Dispatcher ) . useOptimistic = mountOptimistic ;
3056
+ ( HooksDispatcherOnMount : Dispatcher ) . useFormState = mountFormState ;
3024
3057
}
3025
3058
3026
3059
const HooksDispatcherOnUpdate: Dispatcher = {
@@ -3058,6 +3091,7 @@ if (enableFormActions && enableAsyncActions) {
3058
3091
}
3059
3092
if (enableAsyncActions) {
3060
3093
( HooksDispatcherOnUpdate : Dispatcher ) . useOptimistic = updateOptimistic ;
3094
+ ( HooksDispatcherOnUpdate : Dispatcher ) . useFormState = updateFormState ;
3061
3095
}
3062
3096
3063
3097
const HooksDispatcherOnRerender: Dispatcher = {
@@ -3095,6 +3129,7 @@ if (enableFormActions && enableAsyncActions) {
3095
3129
}
3096
3130
if (enableAsyncActions) {
3097
3131
( HooksDispatcherOnRerender : Dispatcher ) . useOptimistic = rerenderOptimistic ;
3132
+ ( HooksDispatcherOnRerender : Dispatcher ) . useFormState = rerenderFormState ;
3098
3133
}
3099
3134
3100
3135
let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
@@ -3287,6 +3322,16 @@ if (__DEV__) {
3287
3322
mountHookTypesDev ( ) ;
3288
3323
return mountOptimistic ( passthrough , reducer ) ;
3289
3324
} ;
3325
+ ( HooksDispatcherOnMountInDEV : Dispatcher ) . useFormState =
3326
+ function useFormState < S , P > (
3327
+ action : ( S , P ) = > S ,
3328
+ initialState : S ,
3329
+ url ?: string ,
3330
+ ) : [ S , ( P ) => void ] {
3331
+ currentHookNameInDev = 'useFormState' ;
3332
+ mountHookTypesDev ( ) ;
3333
+ return mountFormState ( action , initialState , url ) ;
3334
+ } ;
3290
3335
}
3291
3336
3292
3337
HooksDispatcherOnMountWithHookTypesInDEV = {
@@ -3447,6 +3492,16 @@ if (__DEV__) {
3447
3492
updateHookTypesDev ( ) ;
3448
3493
return mountOptimistic ( passthrough , reducer ) ;
3449
3494
} ;
3495
+ ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . useFormState =
3496
+ function useFormState < S , P > (
3497
+ action : ( S , P ) = > S ,
3498
+ initialState : S ,
3499
+ url ?: string ,
3500
+ ) : [ S , ( P ) => void ] {
3501
+ currentHookNameInDev = 'useFormState' ;
3502
+ updateHookTypesDev ( ) ;
3503
+ return mountFormState ( action , initialState , url ) ;
3504
+ } ;
3450
3505
}
3451
3506
3452
3507
HooksDispatcherOnUpdateInDEV = {
@@ -3609,6 +3664,16 @@ if (__DEV__) {
3609
3664
updateHookTypesDev ( ) ;
3610
3665
return updateOptimistic ( passthrough , reducer ) ;
3611
3666
} ;
3667
+ ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . useFormState =
3668
+ function useFormState < S , P > (
3669
+ action : ( S , P ) = > S ,
3670
+ initialState : S ,
3671
+ url ?: string ,
3672
+ ) : [ S , ( P ) => void ] {
3673
+ currentHookNameInDev = 'useFormState' ;
3674
+ updateHookTypesDev ( ) ;
3675
+ return updateFormState ( action , initialState , url ) ;
3676
+ } ;
3612
3677
}
3613
3678
3614
3679
HooksDispatcherOnRerenderInDEV = {
@@ -3771,6 +3836,16 @@ if (__DEV__) {
3771
3836
updateHookTypesDev ( ) ;
3772
3837
return rerenderOptimistic ( passthrough , reducer ) ;
3773
3838
} ;
3839
+ ( HooksDispatcherOnRerenderInDEV : Dispatcher ) . useFormState =
3840
+ function useFormState < S , P > (
3841
+ action : ( S , P ) = > S ,
3842
+ initialState : S ,
3843
+ url ?: string ,
3844
+ ) : [ S , ( P ) => void ] {
3845
+ currentHookNameInDev = 'useFormState' ;
3846
+ updateHookTypesDev ( ) ;
3847
+ return rerenderFormState ( action , initialState , url ) ;
3848
+ } ;
3774
3849
}
3775
3850
3776
3851
InvalidNestedHooksDispatcherOnMountInDEV = {
@@ -3955,6 +4030,17 @@ if (__DEV__) {
3955
4030
mountHookTypesDev ( ) ;
3956
4031
return mountOptimistic ( passthrough , reducer ) ;
3957
4032
} ;
4033
+ ( InvalidNestedHooksDispatcherOnMountInDEV : Dispatcher ) . useFormState =
4034
+ function useFormState < S , P > (
4035
+ action : ( S , P ) = > S ,
4036
+ initialState : S ,
4037
+ url ?: string ,
4038
+ ) : [ S , ( P ) => void ] {
4039
+ currentHookNameInDev = 'useFormState' ;
4040
+ warnInvalidHookAccess ( ) ;
4041
+ mountHookTypesDev ( ) ;
4042
+ return mountFormState ( action , initialState , url ) ;
4043
+ } ;
3958
4044
}
3959
4045
3960
4046
InvalidNestedHooksDispatcherOnUpdateInDEV = {
@@ -4142,6 +4228,17 @@ if (__DEV__) {
4142
4228
updateHookTypesDev ( ) ;
4143
4229
return updateOptimistic ( passthrough , reducer ) ;
4144
4230
} ;
4231
+ ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . useFormState =
4232
+ function useFormState < S , P > (
4233
+ action : ( S , P ) = > S ,
4234
+ initialState : S ,
4235
+ url ?: string ,
4236
+ ) : [ S , ( P ) => void ] {
4237
+ currentHookNameInDev = 'useFormState' ;
4238
+ warnInvalidHookAccess ( ) ;
4239
+ updateHookTypesDev ( ) ;
4240
+ return updateFormState ( action , initialState , url ) ;
4241
+ } ;
4145
4242
}
4146
4243
4147
4244
InvalidNestedHooksDispatcherOnRerenderInDEV = {
@@ -4329,5 +4426,16 @@ if (__DEV__) {
4329
4426
updateHookTypesDev ( ) ;
4330
4427
return rerenderOptimistic ( passthrough , reducer ) ;
4331
4428
} ;
4429
+ ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . useFormState =
4430
+ function useFormState < S , P > (
4431
+ action : ( S , P ) = > S ,
4432
+ initialState : S ,
4433
+ url ?: string ,
4434
+ ) : [ S , ( P ) => void ] {
4435
+ currentHookNameInDev = 'useFormState' ;
4436
+ warnInvalidHookAccess ( ) ;
4437
+ updateHookTypesDev ( ) ;
4438
+ return rerenderFormState ( action , initialState , url ) ;
4439
+ } ;
4332
4440
}
4333
4441
}
0 commit comments