persistent local cache
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
// import { initializeApp } from 'firebase/app'
|
// import { initializeApp } from 'firebase/app'
|
||||||
import firebase from 'firebase/compat/app'
|
import firebase from 'firebase/compat/app'
|
||||||
import type { User } from '@firebase/auth-types'
|
import type { User } from '@firebase/auth-types'
|
||||||
import { getFirestore } from 'firebase/firestore'
|
import {
|
||||||
|
initializeFirestore,
|
||||||
|
persistentLocalCache,
|
||||||
|
persistentMultipleTabManager
|
||||||
|
} from 'firebase/firestore'
|
||||||
import type { Firestore } from 'firebase/firestore'
|
import type { Firestore } from 'firebase/firestore'
|
||||||
|
|
||||||
// import { getAnalytics } from "firebase/analytics";
|
// import { getAnalytics } from "firebase/analytics";
|
||||||
@@ -35,5 +39,9 @@ export const initializeFirebase = () => {
|
|||||||
firebase.auth().onAuthStateChanged((firebaseUser) => {
|
firebase.auth().onAuthStateChanged((firebaseUser) => {
|
||||||
user.value = firebaseUser
|
user.value = firebaseUser
|
||||||
})
|
})
|
||||||
db.value = getFirestore(app)
|
db.value = markRaw(
|
||||||
|
initializeFirestore(app, {
|
||||||
|
localCache: persistentLocalCache({ tabManager: persistentMultipleTabManager() })
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user