Skip to content

Commit c03d807

Browse files
committed
refactor: better types
1 parent 1596a52 commit c03d807

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/nuxt/src/runtime/app/plugin.server.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,17 @@ export default defineNuxtPlugin((nuxtApp) => {
3131

3232
logger.debug('👤 creating new app', appName)
3333

34-
appCache.set(uid, initializeApp(appConfig.firebaseConfig, appName))
35-
firebaseApp = appCache.get(uid)!
34+
firebaseApp = initializeApp(appConfig.firebaseConfig, appName)
35+
appCache.set(uid, firebaseApp)
3636
// console.time('token')
3737
} else {
3838
logger.debug('👤 reusing authenticated app', firebaseApp.name)
3939
}
4040
} else {
4141
// TODO: is this safe? should we create a new one every time
4242
if (!appCache.has('')) {
43-
appCache.set('', initializeApp(appConfig.firebaseConfig))
43+
appCache.set('', (firebaseApp = initializeApp(appConfig.firebaseConfig)))
4444
}
45-
firebaseApp = appCache.get('')!
4645
// anonymous session, just create a new app
4746
logger.debug('🥸 anonymous session')
4847
}

0 commit comments

Comments
 (0)