diff options
author | Eric Bailey <git@esb.lol> | 2023-12-12 17:18:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 15:18:38 -0800 |
commit | b1f9454f1d4404bed9b1b3c656d5f9bbe1d4d39c (patch) | |
tree | de9774fe19fccd813a2c497e6915b9be9b2901c6 /src | |
parent | bf9cedb67bacd1e2667bd1719aadcee92f234966 (diff) | |
download | voidsky-b1f9454f1d4404bed9b1b3c656d5f9bbe1d4d39c.tar.zst |
Add fallback to email reminder modal (#2193)
* Add fallback to email reminder modal * Add more debug
Diffstat (limited to 'src')
-rw-r--r-- | src/state/session/index.tsx | 9 | ||||
-rw-r--r-- | src/view/com/modals/VerifyEmail.tsx | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index 56208bc70..7cdbe6bb8 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -361,6 +361,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } if (canReusePrevSession) { + logger.info(`session: attempting to reuse previous session`) + agent.session = prevSession __globalAgent = agent queryClient.clear() @@ -370,6 +372,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) { resumeSessionWithFreshAccount() .then(freshAccount => { if (JSON.stringify(account) !== JSON.stringify(freshAccount)) { + logger.info( + `session: reuse of previous session returned a fresh account, upserting`, + ) upsertAccount(freshAccount) } }) @@ -385,6 +390,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) { __globalAgent = PUBLIC_BSKY_AGENT }) } else { + logger.info(`session: attempting to resume using previous session`) + try { const freshAccount = await resumeSessionWithFreshAccount() __globalAgent = agent @@ -404,6 +411,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } async function resumeSessionWithFreshAccount(): Promise<SessionAccount> { + logger.info(`session: resumeSessionWithFreshAccount`) + await networkRetry(1, () => agent.resumeSession(prevSession)) /* diff --git a/src/view/com/modals/VerifyEmail.tsx b/src/view/com/modals/VerifyEmail.tsx index 786a814a7..4f2b1aadf 100644 --- a/src/view/com/modals/VerifyEmail.tsx +++ b/src/view/com/modals/VerifyEmail.tsx @@ -22,6 +22,7 @@ import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useModalControls} from '#/state/modals' import {useSession, useSessionApi, getAgent} from '#/state/session' +import {logger} from '#/logger' export const snapPoints = ['90%'] @@ -45,6 +46,13 @@ export function Component({showReminder}: {showReminder?: boolean}) { const {isMobile} = useWebMediaQueries() const {openModal, closeModal} = useModalControls() + React.useEffect(() => { + if (!currentAccount) { + logger.error(`VerifyEmail modal opened without currentAccount`) + closeModal() + } + }, [currentAccount, closeModal]) + const onSendEmail = async () => { setError('') setIsProcessing(true) |