Skip to content

Commit e0551fa

Browse files
authored
Catch more heartbeat read/write errors (#7272)
1 parent 8051e4a commit e0551fa

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/sixty-dolls-report.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app': patch
3+
---
4+
5+
Catch more heartbeat read/write errors.

packages/app/src/indexeddb.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ export async function readHeartbeatsFromIndexedDB(
6262
): Promise<HeartbeatsInIndexedDB | undefined> {
6363
try {
6464
const db = await getDbPromise();
65-
return db
65+
const result = await db
6666
.transaction(STORE_NAME)
6767
.objectStore(STORE_NAME)
68-
.get(computeKey(app)) as Promise<HeartbeatsInIndexedDB | undefined>;
68+
.get(computeKey(app));
69+
return result;
6970
} catch (e) {
7071
if (e instanceof FirebaseError) {
7172
logger.warn(e.message);
@@ -87,7 +88,7 @@ export async function writeHeartbeatsToIndexedDB(
8788
const tx = db.transaction(STORE_NAME, 'readwrite');
8889
const objectStore = tx.objectStore(STORE_NAME);
8990
await objectStore.put(heartbeatObject, computeKey(app));
90-
return tx.done;
91+
await tx.done;
9192
} catch (e) {
9293
if (e instanceof FirebaseError) {
9394
logger.warn(e.message);

0 commit comments

Comments
 (0)