Skip to content

Don't persist documents that we already have #2099

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

Merged
merged 5 commits into from
Aug 22, 2019

Conversation

schmidt-sebastian
Copy link
Contributor

This PR changes the handling of remote documents to skip any document updates for document versions that we already have cached. To keep the code readable, I removed the concept of authoritativeUpdates (as discussed in the API discussion phase of Sprint planning).

Copy link
Contributor

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the same comments as the Android port plus one question.

@@ -580,22 +558,21 @@ export class LocalStore {
// can synthesize remote events when we get permission denied errors while
// trying to resolve the state of a locally cached document that is in
// limbo.
const remoteVersion = remoteEvent.snapshotVersion;
if (!remoteVersion.isEqual(SnapshotVersion.MIN)) {
if (!snapshotVersion.isEqual(SnapshotVersion.MIN)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why doesn't this change apply to the Android port?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a rename to which allows me to use an object shorthand notation (instead of {snapshotVersion:remoteVersion} I can now use {snapshotVersion}.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed your feedback (ported the changes for Android).

Since I was mucking around in the same codepath I also pulled in firebase/firebase-android-sdk#721

@@ -580,22 +558,21 @@ export class LocalStore {
// can synthesize remote events when we get permission denied errors while
// trying to resolve the state of a locally cached document that is in
// limbo.
const remoteVersion = remoteEvent.snapshotVersion;
if (!remoteVersion.isEqual(SnapshotVersion.MIN)) {
if (!snapshotVersion.isEqual(SnapshotVersion.MIN)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a rename to which allows me to use an object shorthand notation (instead of {snapshotVersion:remoteVersion} I can now use {snapshotVersion}.

@schmidt-sebastian schmidt-sebastian merged commit 919bcbd into master Aug 22, 2019
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/limitupdates branch August 22, 2019 17:28
@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants