Skip to content

Fix Document update conflict error#531

Merged
sindresorhus merged 1 commit into
masterfrom
fix-document-conflict
Sep 29, 2018
Merged

Fix Document update conflict error#531
sindresorhus merged 1 commit into
masterfrom
fix-document-conflict

Conversation

@sindresorhus
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants