@@ -1835,6 +1835,37 @@ function rerenderOptimistic<S, A>(
18351835 return [ passthrough , dispatch ] ;
18361836}
18371837
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+
18381869function pushEffect (
18391870 tag : HookFlags ,
18401871 create : ( ) = > ( ( ) => void ) | void ,
@@ -2984,6 +3015,7 @@ if (enableFormActions && enableAsyncActions) {
29843015}
29853016if (enableAsyncActions) {
29863017 ( ContextOnlyDispatcher : Dispatcher ) . useOptimistic = throwInvalidHookError ;
3018+ ( ContextOnlyDispatcher : Dispatcher ) . useFormState = throwInvalidHookError ;
29873019}
29883020
29893021const HooksDispatcherOnMount: Dispatcher = {
@@ -3021,6 +3053,7 @@ if (enableFormActions && enableAsyncActions) {
30213053}
30223054if (enableAsyncActions) {
30233055 ( HooksDispatcherOnMount : Dispatcher ) . useOptimistic = mountOptimistic ;
3056+ ( HooksDispatcherOnMount : Dispatcher ) . useFormState = mountFormState ;
30243057}
30253058
30263059const HooksDispatcherOnUpdate: Dispatcher = {
@@ -3058,6 +3091,7 @@ if (enableFormActions && enableAsyncActions) {
30583091}
30593092if (enableAsyncActions) {
30603093 ( HooksDispatcherOnUpdate : Dispatcher ) . useOptimistic = updateOptimistic ;
3094+ ( HooksDispatcherOnUpdate : Dispatcher ) . useFormState = updateFormState ;
30613095}
30623096
30633097const HooksDispatcherOnRerender: Dispatcher = {
@@ -3095,6 +3129,7 @@ if (enableFormActions && enableAsyncActions) {
30953129}
30963130if (enableAsyncActions) {
30973131 ( HooksDispatcherOnRerender : Dispatcher ) . useOptimistic = rerenderOptimistic ;
3132+ ( HooksDispatcherOnRerender : Dispatcher ) . useFormState = rerenderFormState ;
30983133}
30993134
31003135let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
@@ -3287,6 +3322,16 @@ if (__DEV__) {
32873322 mountHookTypesDev ( ) ;
32883323 return mountOptimistic ( passthrough , reducer ) ;
32893324 } ;
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+ } ;
32903335 }
32913336
32923337 HooksDispatcherOnMountWithHookTypesInDEV = {
@@ -3447,6 +3492,16 @@ if (__DEV__) {
34473492 updateHookTypesDev ( ) ;
34483493 return mountOptimistic ( passthrough , reducer ) ;
34493494 } ;
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+ } ;
34503505 }
34513506
34523507 HooksDispatcherOnUpdateInDEV = {
@@ -3609,6 +3664,16 @@ if (__DEV__) {
36093664 updateHookTypesDev ( ) ;
36103665 return updateOptimistic ( passthrough , reducer ) ;
36113666 } ;
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+ } ;
36123677 }
36133678
36143679 HooksDispatcherOnRerenderInDEV = {
@@ -3771,6 +3836,16 @@ if (__DEV__) {
37713836 updateHookTypesDev ( ) ;
37723837 return rerenderOptimistic ( passthrough , reducer ) ;
37733838 } ;
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+ } ;
37743849 }
37753850
37763851 InvalidNestedHooksDispatcherOnMountInDEV = {
@@ -3955,6 +4030,17 @@ if (__DEV__) {
39554030 mountHookTypesDev ( ) ;
39564031 return mountOptimistic ( passthrough , reducer ) ;
39574032 } ;
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+ } ;
39584044 }
39594045
39604046 InvalidNestedHooksDispatcherOnUpdateInDEV = {
@@ -4142,6 +4228,17 @@ if (__DEV__) {
41424228 updateHookTypesDev ( ) ;
41434229 return updateOptimistic ( passthrough , reducer ) ;
41444230 } ;
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+ } ;
41454242 }
41464243
41474244 InvalidNestedHooksDispatcherOnRerenderInDEV = {
@@ -4329,5 +4426,16 @@ if (__DEV__) {
43294426 updateHookTypesDev ( ) ;
43304427 return rerenderOptimistic ( passthrough , reducer ) ;
43314428 } ;
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+ } ;
43324440 }
43334441}
0 commit comments