about summary refs log tree commit diff
path: root/src/state/shell/logged-out.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-27 19:35:20 -0700
committerGitHub <noreply@github.com>2024-06-27 19:35:20 -0700
commit91c4aa7c2dc598dd5e2c828e44c0d2c94cf0967d (patch)
tree362f79f88bab8107053c1fe0201ddcb4d0d21ac5 /src/state/shell/logged-out.tsx
parent030c8e268e161bebe360e3ad97b1c18bd8425ca8 (diff)
downloadvoidsky-91c4aa7c2dc598dd5e2c828e44c0d2c94cf0967d.tar.zst
Handle pressing all go.bsky.app links in-app w/ resolution (#4680)
Diffstat (limited to 'src/state/shell/logged-out.tsx')
-rw-r--r--src/state/shell/logged-out.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/state/shell/logged-out.tsx b/src/state/shell/logged-out.tsx
index dc78d03d5..2c577fdd2 100644
--- a/src/state/shell/logged-out.tsx
+++ b/src/state/shell/logged-out.tsx
@@ -50,6 +50,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
   const activeStarterPack = useActiveStarterPack()
   const {hasSession} = useSession()
   const shouldShowStarterPack = Boolean(activeStarterPack?.uri) && !hasSession
+
   const [state, setState] = React.useState<State>({
     showLoggedOut: shouldShowStarterPack,
     requestedAccountSwitchTo: shouldShowStarterPack
@@ -59,6 +60,25 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
       : undefined,
   })
 
+  const [prevActiveStarterPack, setPrevActiveStarterPack] =
+    React.useState(activeStarterPack)
+  if (activeStarterPack?.uri !== prevActiveStarterPack?.uri) {
+    setPrevActiveStarterPack(activeStarterPack)
+    if (activeStarterPack) {
+      setState(s => ({
+        ...s,
+        showLoggedOut: true,
+        requestedAccountSwitchTo: 'starterpack',
+      }))
+    } else {
+      setState(s => ({
+        ...s,
+        showLoggedOut: false,
+        requestedAccountSwitchTo: undefined,
+      }))
+    }
+  }
+
   const controls = React.useMemo<Controls>(
     () => ({
       setShowLoggedOut(show) {