-
Notifications
You must be signed in to change notification settings - Fork 929
Don't update query target metadata for updates #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d56990a
3f49ba0
d444fda
86d41cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,12 +87,16 @@ export class IndexedDbQueryCache implements QueryCache { | |
}); | ||
} | ||
|
||
setLastRemoteSnapshotVersion( | ||
setTargetsMetadata( | ||
transaction: PersistenceTransaction, | ||
snapshotVersion: SnapshotVersion | ||
highestListenSequenceNumber: number, | ||
lastRemoteSnapshotVersion?: SnapshotVersion | ||
): PersistencePromise<void> { | ||
return this.retrieveMetadata(transaction).next(metadata => { | ||
metadata.lastRemoteSnapshotVersion = snapshotVersion.toTimestamp(); | ||
metadata.highestListenSequenceNumber = highestListenSequenceNumber; | ||
if (lastRemoteSnapshotVersion) { | ||
metadata.lastRemoteSnapshotVersion = lastRemoteSnapshotVersion.toTimestamp(); | ||
} | ||
return this.saveMetadata(transaction, metadata); | ||
}); | ||
} | ||
|
@@ -114,15 +118,7 @@ export class IndexedDbQueryCache implements QueryCache { | |
transaction: PersistenceTransaction, | ||
queryData: QueryData | ||
): PersistencePromise<void> { | ||
return this.saveQueryData(transaction, queryData).next(() => { | ||
return this.retrieveMetadata(transaction).next(metadata => { | ||
if (this.updateMetadataFromQueryData(queryData, metadata)) { | ||
return this.saveMetadata(transaction, metadata); | ||
} else { | ||
return PersistencePromise.resolve(); | ||
} | ||
}); | ||
}); | ||
return this.saveQueryData(transaction, queryData); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will still potentially need to update the metadata. Once There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the PR to allow future Greg to set the sequence number as part of the I am also still accepting nominations for the API name voting challenge. |
||
} | ||
|
||
removeQueryData( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this optional? Do we ever not supply it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local Store doesn't always call setLastRemoteSnapshotVersion. Do you still want to update the listen sequence number?
See https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/local/local_store.ts#L524
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I do still want to update the sequence number. I guess optional is ok, although it looks like in that case we could also pass in the highest snapshot version and have it be a no-op. I don't feel too strongly either way though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can refine the API when we start porting to Web, but I believe the highest snapshot version that you know of could be SnapshotVersion.MIN (unless you pass the version that you just got from getLastRemoteSnapshotVersion).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I meant the one you just read. But yeah, we can update later if need be.