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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user