Skip to content

Commit

Permalink
fix: fixed enableMultiTabIndexedDbPersistence usage
Browse files Browse the repository at this point in the history
- fixed issue where trying to use both enableMultiTabIndexedDbPersistence and enableMultiTabIndexedDbPersistence at the same time
- enableMultiTabIndexedDbPersistence is now the default, with enableIndexedDbPersistence being used if enableMultiTabIndexedDbPersistence is false
  • Loading branch information
dereekb committed Jan 24, 2023
1 parent 0db398a commit 2c41552
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions packages/dbx-firebase/src/lib/firebase/firebase.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ import { DbxFirebaseAppCheckHttpInterceptor } from '../auth/appcheck/appcheck.in
connectFirestoreEmulator(firestore, emulators.firestore.host, emulators.firestore.port, {});
}

if (firebaseOptions.enableIndexedDbPersistence !== false) {
enableIndexedDbPersistence(firestore);
}

if (firebaseOptions.enableMultiTabIndexedDbPersistence !== false) {
enableMultiTabIndexedDbPersistence(firestore);
} else if (firebaseOptions.enableIndexedDbPersistence !== false) {
enableIndexedDbPersistence(firestore);
}

return firestore;
Expand Down
10 changes: 5 additions & 5 deletions packages/dbx-firebase/src/lib/firebase/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export interface DbxFirebaseOptions extends FirebaseOptions, Pick<DbxFirebaseLog
*/
functionsRegionOrCustomDomain?: string | undefined;
/**
* Whether or not to call enableIndexedDbPersistence() for firestore at setup time.
* Whether or not to call enableMultiTabIndexedDbPersistence() for firestore at setup time.
*
* True by default.
*/
enableIndexedDbPersistence?: boolean;
enableMultiTabIndexedDbPersistence?: boolean;
/**
* Whether or not to call enableMultiTabIndexedDbPersistence() for firestore at setup time.
* Whether or not to call enableIndexedDbPersistence() for firestore at setup time.
*
* True by default.
* True by default if enableMultiTabIndexedDbPersistence is false.
*/
enableMultiTabIndexedDbPersistence?: boolean;
enableIndexedDbPersistence?: boolean;
}

0 comments on commit 2c41552

Please sign in to comment.