about summary refs log tree commit diff
path: root/src/state/session
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2023-12-06 20:04:05 +0000
committerGitHub <noreply@github.com>2023-12-06 12:04:05 -0800
commit6335be14e17c7bf1a36e9103148277717e3a7a90 (patch)
treec10f139dc2507a38bb3c58819cc19382279a675f /src/state/session
parent748212e000f963976bca5d63e0961d75a7e8b296 (diff)
downloadvoidsky-6335be14e17c7bf1a36e9103148277717e3a7a90.tar.zst
Move analytics out of init (#2115)
* Remove listenSessionLoaded from analytics

* Move analytics init call to navigation ready

* Remove zod dependency from analytics

* Mirror changes on the web

* Delete listenSessionLoaded

* Only set up listeners once
Diffstat (limited to 'src/state/session')
-rw-r--r--src/state/session/index.tsx10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx
index 49c1326d9..76b77a087 100644
--- a/src/state/session/index.tsx
+++ b/src/state/session/index.tsx
@@ -8,7 +8,7 @@ import {logger} from '#/logger'
 import * as persisted from '#/state/persisted'
 import {PUBLIC_BSKY_AGENT} from '#/state/queries'
 import {IS_PROD} from '#/lib/constants'
-import {emitSessionLoaded, emitSessionDropped} from '../events'
+import {emitSessionDropped} from '../events'
 import {useLoggedOutViewControls} from '#/state/shell/logged-out'
 import {useCloseAllActiveElements} from '#/state/util'
 import {track} from '#/lib/analytics/analytics'
@@ -210,7 +210,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
       __globalAgent = agent
       queryClient.clear()
       upsertAccount(account)
-      emitSessionLoaded(account, agent)
 
       logger.debug(
         `session: created account`,
@@ -262,7 +261,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
       __globalAgent = agent
       queryClient.clear()
       upsertAccount(account)
-      emitSessionLoaded(account, agent)
 
       logger.debug(
         `session: logged in`,
@@ -355,12 +353,11 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
         __globalAgent = agent
         queryClient.clear()
         upsertAccount(account)
-        emitSessionLoaded(account, agent)
+
         // Intentionally not awaited to unblock the UI:
-        resumeSessionWithFreshAccount().then(async freshAccount => {
+        resumeSessionWithFreshAccount().then(freshAccount => {
           if (JSON.stringify(account) !== JSON.stringify(freshAccount)) {
             upsertAccount(freshAccount)
-            emitSessionLoaded(freshAccount, agent)
           }
         })
       } else {
@@ -368,7 +365,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
         __globalAgent = agent
         queryClient.clear()
         upsertAccount(freshAccount)
-        emitSessionLoaded(freshAccount, agent)
       }
 
       async function resumeSessionWithFreshAccount(): Promise<SessionAccount> {