File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @firebase/app ' : patch
3
+ ---
4
+
5
+ More safeguards to ensure that heartbeat objects queried from IndexedDB include a heartbeats field.
Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ export class HeartbeatServiceImpl implements HeartbeatService {
90
90
const date = getUTCDateString ( ) ;
91
91
if ( this . _heartbeatsCache ?. heartbeats == null ) {
92
92
this . _heartbeatsCache = await this . _heartbeatsCachePromise ;
93
+ // If we failed to construct a heartbeats cache, then return immediately.
94
+ if ( this . _heartbeatsCache ?. heartbeats == null ) {
95
+ return ;
96
+ }
93
97
}
94
98
// Do not store a heartbeat if one is already stored for this day
95
99
// or if a header has already been sent today.
@@ -236,7 +240,11 @@ export class HeartbeatStorageImpl implements HeartbeatStorage {
236
240
return { heartbeats : [ ] } ;
237
241
} else {
238
242
const idbHeartbeatObject = await readHeartbeatsFromIndexedDB ( this . app ) ;
239
- return idbHeartbeatObject || { heartbeats : [ ] } ;
243
+ if ( idbHeartbeatObject ?. heartbeats ) {
244
+ return idbHeartbeatObject ;
245
+ } else {
246
+ return { heartbeats : [ ] } ;
247
+ }
240
248
}
241
249
}
242
250
// overwrite the storage with the provided heartbeats
You can’t perform that action at this time.
0 commit comments