fix onboarding stuck on welcome

This commit is contained in:
Ansh Nanda 2023-08-28 15:50:51 -07:00
parent 3f1b313fa4
commit b2dd4ea0f5

View file

@ -14,14 +14,18 @@ type OnboardingStep =
const OnboardingStepsArray = Object.values(OnboardingScreenSteps) const OnboardingStepsArray = Object.values(OnboardingScreenSteps)
export class OnboardingModel { export class OnboardingModel {
// state // state
step: OnboardingStep step: OnboardingStep = 'Welcome'
constructor(public rootStore: RootStoreModel) { constructor(public rootStore: RootStoreModel) {
makeAutoObservable(this, {rootStore: false}) makeAutoObservable(this, {
this.step = 'Welcome' rootStore: false,
hydrate: false,
serialize: false,
})
} }
serialize() { serialize(): unknown {
console.log('serializing onboarding', this.step)
return { return {
step: this.step, step: this.step,
} }
@ -37,9 +41,10 @@ export class OnboardingModel {
console.log('hydrating onboarding', v.step) console.log('hydrating onboarding', v.step)
this.step = v.step as OnboardingStep this.step = v.step as OnboardingStep
} }
} else {
// if there is no valid state, we'll just reset
this.reset()
} }
// if there is no valid state, we'll just reset
this.reset()
} }
nextScreenName(currentScreenName?: OnboardingStep) { nextScreenName(currentScreenName?: OnboardingStep) {