Skip to content
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

Fix Document update conflict error #531

Merged
merged 1 commit into from Sep 29, 2018
Merged

Conversation

sindresorhus
Copy link
Contributor

Fixes #527
Fixes #528

We were not correctly updating the PouchDB documents. There is a required ceremony of updating _rev that we were not doing. I think the issue only first showed up now as IndexedDB either got faster or something changed internally with the Electron 3 upgrade.

See: https://pouchdb.com/guides/updating-deleting.html

I'm using pouchdb-upsert which handles some of the complications of updating a document.

Fixes #527
Fixes #528

We were not correctly updating the PouchDB documents. There is a required ceremony of updating `_rev` that we were not doing. I think the issue only first showed up now as IndexedDB either got faster or something changed internally with the Electron 3 upgrade.

See: https://pouchdb.com/guides/updating-deleting.html

I'm using `pouchdb-upsert` which handles some of the complications of updating a document.
@sindresorhus
Copy link
Contributor Author

I tested the beta and got the Conflict update error too. With these changes, I built for production, ran it, and now got a swap through without any errors, so seems to be working.

@lukechilds
Copy link
Member

Awesome good catch!

Sorry, totally missed that, assumed db.put() was completely safe for updating.

@sindresorhus sindresorhus merged commit a4a5914 into master Sep 29, 2018
@sindresorhus sindresorhus deleted the fix-document-conflict branch September 29, 2018 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants