about summary refs log tree commit diff
path: root/src/screens/Signup/StepCaptcha/index.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-08-22 22:43:23 +0100
committerGitHub <noreply@github.com>2024-08-22 22:43:23 +0100
commit27bb3832683275be0c778a38c526bfd55cebee59 (patch)
tree02b0e1a9c802b0f75ac33d3e00daa95203e322cc /src/screens/Signup/StepCaptcha/index.tsx
parentdf5bf28e614150bda5d58b22b7db308f71f70e07 (diff)
downloadvoidsky-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/StepCaptcha/index.tsx')
-rw-r--r--src/screens/Signup/StepCaptcha/index.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/screens/Signup/StepCaptcha/index.tsx b/src/screens/Signup/StepCaptcha/index.tsx
index bf3576490..e233d31dd 100644
--- a/src/screens/Signup/StepCaptcha/index.tsx
+++ b/src/screens/Signup/StepCaptcha/index.tsx
@@ -8,7 +8,7 @@ import {createFullHandle} from '#/lib/strings/handles'
 import {logger} from '#/logger'
 import {logEvent} from 'lib/statsig/statsig'
 import {ScreenTransition} from '#/screens/Login/ScreenTransition'
-import {useSignupContext, useSubmitSignup} from '#/screens/Signup/state'
+import {useSignupContext} from '#/screens/Signup/state'
 import {CaptchaWebView} from '#/screens/Signup/StepCaptcha/CaptchaWebView'
 import {atoms as a, useTheme} from '#/alf'
 import {FormError} from '#/components/forms/FormError'
@@ -20,7 +20,6 @@ export function StepCaptcha() {
   const {_} = useLingui()
   const theme = useTheme()
   const {state, dispatch} = useSignupContext()
-  const submit = useSubmitSignup({state, dispatch})
 
   const [completed, setCompleted] = React.useState(false)
 
@@ -42,9 +41,13 @@ export function StepCaptcha() {
     (code: string) => {
       setCompleted(true)
       logEvent('signup:captchaSuccess', {})
-      submit(code)
+      const submitTask = {code, mutableProcessed: false}
+      dispatch({
+        type: 'submit',
+        task: submitTask,
+      })
     },
-    [submit],
+    [dispatch],
   )
 
   const onError = React.useCallback(