diff options
author | dan <dan.abramov@gmail.com> | 2024-05-08 03:30:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 03:30:55 +0100 |
commit | 0910525e2efe124c63c1c8147a98450e43110681 (patch) | |
tree | 58162303b6c224e9ad90c552f66e29c7415bece4 /src/App.web.tsx | |
parent | 4fe5a869c32c696862308cb8ff4537f34f43f06a (diff) | |
download | voidsky-0910525e2efe124c63c1c8147a98450e43110681.tar.zst |
[Session] Code cleanup (#3854)
* Split utils into files * Move reducer to another file * Write types explicitly * Remove unnnecessary check * Move things around a bit * Move more stuff into agent factories * Move more stuff into agent * Fix gates await * Clarify comments * Enforce more via types * Nit * initSession -> resumeSession * Protect against races * Make agent opaque to reducer * Check using plain condition
Diffstat (limited to 'src/App.web.tsx')
-rw-r--r-- | src/App.web.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/App.web.tsx b/src/App.web.tsx index 87909a276..40ceb6942 100644 --- a/src/App.web.tsx +++ b/src/App.web.tsx @@ -45,17 +45,17 @@ import {listenSessionDropped} from './state/events' function InnerApp() { const [isReady, setIsReady] = React.useState(false) const {currentAccount} = useSession() - const {initSession} = useSessionApi() + const {resumeSession} = useSessionApi() const theme = useColorModeTheme() const {_} = useLingui() useIntentHandler() // init useEffect(() => { - async function resumeSession(account?: SessionAccount) { + async function onLaunch(account?: SessionAccount) { try { if (account) { - await initSession(account) + await resumeSession(account) } } catch (e) { logger.error(`session: resumeSession failed`, {message: e}) @@ -64,8 +64,8 @@ function InnerApp() { } } const account = readLastActiveAccount() - resumeSession(account) - }, [initSession]) + onLaunch(account) + }, [resumeSession]) useEffect(() => { return listenSessionDropped(() => { |