Skip to content

Commit 6f978bd

Browse files
don't use indexeddb
1 parent 0483630 commit 6f978bd

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/main.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ import { definePreset } from '@primevue/themes'
22
import Aura from '@primevue/themes/aura'
33
import * as Sentry from '@sentry/vue'
44
import { initializeApp } from 'firebase/app'
5+
import {
6+
browserLocalPersistence,
7+
browserSessionPersistence,
8+
indexedDBLocalPersistence
9+
} from 'firebase/auth'
510
import { createPinia } from 'pinia'
611
import 'primeicons/primeicons.css'
712
import PrimeVue from 'primevue/config'
813
import ConfirmationService from 'primevue/confirmationservice'
914
import ToastService from 'primevue/toastservice'
1015
import Tooltip from 'primevue/tooltip'
1116
import { createApp } from 'vue'
12-
import { VueFire, VueFireAuth } from 'vuefire'
17+
import { VueFire, VueFireAuthWithDependencies } from 'vuefire'
1318

1419
import { FIREBASE_CONFIG } from '@/config/firebase'
1520
import '@/lib/litegraph/public/css/litegraph.css'
@@ -66,6 +71,18 @@ app
6671
.use(i18n)
6772
.use(VueFire, {
6873
firebaseApp,
69-
modules: [VueFireAuth()]
74+
modules: [
75+
// Configure Firebase Auth persistence: localStorage first, IndexedDB last.
76+
// Localstorage is preferred to IndexedDB for mobile Safari compatibility.
77+
VueFireAuthWithDependencies({
78+
dependencies: {
79+
persistence: [
80+
browserLocalPersistence,
81+
browserSessionPersistence,
82+
indexedDBLocalPersistence
83+
]
84+
}
85+
})
86+
]
7087
})
7188
.mount('#vue-app')

src/stores/firebaseAuthStore.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import {
66
GoogleAuthProvider,
77
type User,
88
type UserCredential,
9-
browserLocalPersistence,
109
createUserWithEmailAndPassword,
1110
deleteUser,
1211
onAuthStateChanged,
1312
sendPasswordResetEmail,
14-
setPersistence,
1513
signInWithEmailAndPassword,
1614
signInWithPopup,
1715
signOut,
@@ -80,8 +78,6 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
8078
// Retrieves the Firebase Auth instance. Returns `null` on the server.
8179
// When using this function on the client in TypeScript, you can force the type with `useFirebaseAuth()!`.
8280
const auth = useFirebaseAuth()!
83-
// Set persistence to localStorage (works in both browser and Electron)
84-
void setPersistence(auth, browserLocalPersistence)
8581

8682
onAuthStateChanged(auth, (user) => {
8783
currentUser.value = user

0 commit comments

Comments
 (0)