@@ -87,12 +87,16 @@ export class IndexedDbQueryCache implements QueryCache {
8787 } ) ;
8888 }
8989
90- setLastRemoteSnapshotVersion (
90+ setTargetsMetadata (
9191 transaction : PersistenceTransaction ,
92- snapshotVersion : SnapshotVersion
92+ highestListenSequenceNumber : number ,
93+ lastRemoteSnapshotVersion ?: SnapshotVersion
9394 ) : PersistencePromise < void > {
9495 return this . retrieveMetadata ( transaction ) . next ( metadata => {
95- metadata . lastRemoteSnapshotVersion = snapshotVersion . toTimestamp ( ) ;
96+ metadata . highestListenSequenceNumber = highestListenSequenceNumber ;
97+ if ( lastRemoteSnapshotVersion ) {
98+ metadata . lastRemoteSnapshotVersion = lastRemoteSnapshotVersion . toTimestamp ( ) ;
99+ }
96100 return this . saveMetadata ( transaction , metadata ) ;
97101 } ) ;
98102 }
@@ -114,15 +118,7 @@ export class IndexedDbQueryCache implements QueryCache {
114118 transaction : PersistenceTransaction ,
115119 queryData : QueryData
116120 ) : 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 ) ;
126122 }
127123
128124 removeQueryData (
0 commit comments