@@ -87,12 +87,16 @@ export class IndexedDbQueryCache implements QueryCache {
87
87
} ) ;
88
88
}
89
89
90
- setLastRemoteSnapshotVersion (
90
+ setTargetsMetadata (
91
91
transaction : PersistenceTransaction ,
92
- snapshotVersion : SnapshotVersion
92
+ highestListenSequenceNumber : number ,
93
+ lastRemoteSnapshotVersion ?: SnapshotVersion
93
94
) : PersistencePromise < void > {
94
95
return this . retrieveMetadata ( transaction ) . next ( metadata => {
95
- metadata . lastRemoteSnapshotVersion = snapshotVersion . toTimestamp ( ) ;
96
+ metadata . highestListenSequenceNumber = highestListenSequenceNumber ;
97
+ if ( lastRemoteSnapshotVersion ) {
98
+ metadata . lastRemoteSnapshotVersion = lastRemoteSnapshotVersion . toTimestamp ( ) ;
99
+ }
96
100
return this . saveMetadata ( transaction , metadata ) ;
97
101
} ) ;
98
102
}
@@ -114,15 +118,7 @@ export class IndexedDbQueryCache implements QueryCache {
114
118
transaction : PersistenceTransaction ,
115
119
queryData : QueryData
116
120
) : PersistencePromise < void > {
117
- return this . saveQueryData ( transaction , queryData ) . next ( ( ) => {
118
- return this . retrieveMetadata ( transaction ) . next ( metadata => {
119
- if ( this . updateMetadataFromQueryData ( queryData , metadata ) ) {
120
- return this . saveMetadata ( transaction , metadata ) ;
121
- } else {
122
- return PersistencePromise . resolve ( ) ;
123
- }
124
- } ) ;
125
- } ) ;
121
+ return this . saveQueryData ( transaction , queryData ) ;
126
122
}
127
123
128
124
removeQueryData (
0 commit comments