diff options
author | dan <dan.abramov@gmail.com> | 2024-08-22 22:43:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 22:43:23 +0100 |
commit | 27bb3832683275be0c778a38c526bfd55cebee59 (patch) | |
tree | 02b0e1a9c802b0f75ac33d3e00daa95203e322cc /src/screens/Signup/index.tsx | |
parent | df5bf28e614150bda5d58b22b7db308f71f70e07 (diff) | |
download | voidsky-27bb3832683275be0c778a38c526bfd55cebee59.tar.zst |
Submit fix (#4978)
* Fix submit logic * Fix type * Align submit task creation 1:1 with callsites * blegh. `useThrottledValue` * make `useThrottledValue`'s time required --------- Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/screens/Signup/index.tsx')
-rw-r--r-- | src/screens/Signup/index.tsx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/screens/Signup/index.tsx b/src/screens/Signup/index.tsx index 189760460..0e1a2e61f 100644 --- a/src/screens/Signup/index.tsx +++ b/src/screens/Signup/index.tsx @@ -16,6 +16,7 @@ import { reducer, SignupContext, SignupStep, + useSubmitSignup, } from '#/screens/Signup/state' import {StepCaptcha} from '#/screens/Signup/StepCaptcha' import {StepHandle} from '#/screens/Signup/StepHandle' @@ -33,6 +34,7 @@ export function Signup({onPressBack}: {onPressBack: () => void}) { const {screen} = useAnalytics() const [state, dispatch] = React.useReducer(reducer, initialState) const {gtMobile} = useBreakpoints() + const submit = useSubmitSignup() const activeStarterPack = useActiveStarterPack() const { @@ -81,6 +83,15 @@ export function Signup({onPressBack}: {onPressBack: () => void}) { } }, [_, serviceInfo, isError]) + React.useEffect(() => { + if (state.pendingSubmit) { + if (!state.pendingSubmit.mutableProcessed) { + state.pendingSubmit.mutableProcessed = true + submit(state, dispatch) + } + } + }, [state, dispatch, submit]) + return ( <SignupContext.Provider value={{state, dispatch}}> <LoggedOutLayout |