Move onboarding state to new persistence + reducer context (#1835)

This commit is contained in:
Paul Frazee 2023-11-08 09:04:06 -08:00 committed by GitHub
parent 3a211017d3
commit 4afed4be28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 199 additions and 167 deletions

View file

@ -15,6 +15,7 @@ import {s} from 'lib/styles'
import {useStores} from 'state/index'
import {CreateAccountModel} from 'state/models/ui/create-account'
import {usePalette} from 'lib/hooks/usePalette'
import {useOnboardingDispatch} from '#/state/shell'
import {Step1} from './Step1'
import {Step2} from './Step2'
@ -29,6 +30,7 @@ export const CreateAccount = observer(function CreateAccountImpl({
const pal = usePalette('default')
const store = useStores()
const model = React.useMemo(() => new CreateAccountModel(store), [store])
const onboardingDispatch = useOnboardingDispatch()
React.useEffect(() => {
screen('CreateAccount')
@ -59,14 +61,14 @@ export const CreateAccount = observer(function CreateAccountImpl({
model.next()
} else {
try {
await model.submit()
await model.submit(onboardingDispatch)
} catch {
// dont need to handle here
} finally {
track('Try Create Account')
}
}
}, [model, track])
}, [model, track, onboardingDispatch])
return (
<LoggedOutLayout