Skip to content

Commit 73c2d72

Browse files
committed
fix(database): setPersistenceEnabled called multiple times
fixes #91
1 parent 2ee0bcf commit 73c2d72

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/firebase-database/index.android.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,16 +656,20 @@ export class Database implements IDatabase {
656656
}
657657

658658
set persistenceCacheSizeBytes(bytes) {
659-
this.native.setPersistenceCacheSizeBytes(bytes);
660-
this.#persistenceCacheSizeBytes = bytes;
659+
try {
660+
this.native.setPersistenceCacheSizeBytes(bytes);
661+
this.#persistenceCacheSizeBytes = bytes;
662+
} catch (e) {}
661663
}
662664
#persistenceEnabled: boolean = false;
663665
get persistenceEnabled(): boolean {
664666
return this.#persistenceEnabled;
665667
}
666668
set persistenceEnabled(value) {
667-
this.native.setPersistenceEnabled(value);
668-
this.#persistenceEnabled = value;
669+
try {
670+
this.native.setPersistenceEnabled(value);
671+
this.#persistenceEnabled = value;
672+
} catch (e) {}
669673
}
670674

671675
refFromURL(url: string): Reference {

0 commit comments

Comments
 (0)