about summary refs log tree commit diff
path: root/src/state/shell/onboarding.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-09 17:14:51 -0600
committerGitHub <noreply@github.com>2023-11-09 15:14:51 -0800
commit625cbc435f15bc0d611661b44dbf8add990dff7d (patch)
treec0bdafd65783a52410c874721510f73fbc9a9828 /src/state/shell/onboarding.tsx
parent664e7a91a96dfea08d47162ce67adb04412696c0 (diff)
downloadvoidsky-625cbc435f15bc0d611661b44dbf8add990dff7d.tar.zst
First pass at a session handler (#1850)
* First pass at a session handler

* TODOs

* Fix recursion

* Couple more things

* Add back resume session concept

* Handle ready

* Cleanup of initial loading states

* Handle init failure

* Cleanup

* Remove account

* Add updateCurrentAccount

* Remove log

* Cleanup

* Integrate removeAccount

* Add hasSession

* Add to App.native, harden migration

* Use effect to persist data
Diffstat (limited to 'src/state/shell/onboarding.tsx')
-rw-r--r--src/state/shell/onboarding.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/state/shell/onboarding.tsx b/src/state/shell/onboarding.tsx
index 5963cc50e..6a18b461f 100644
--- a/src/state/shell/onboarding.tsx
+++ b/src/state/shell/onboarding.tsx
@@ -82,12 +82,16 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
 
   React.useEffect(() => {
     return persisted.onUpdate(() => {
-      dispatch({
-        type: 'set',
-        step: persisted.get('onboarding').step as OnboardingStep,
-      })
+      const next = persisted.get('onboarding').step
+      // TODO we've introduced a footgun
+      if (state.step !== next) {
+        dispatch({
+          type: 'set',
+          step: persisted.get('onboarding').step as OnboardingStep,
+        })
+      }
     })
-  }, [dispatch])
+  }, [state, dispatch])
 
   return (
     <stateContext.Provider value={state}>