dw-innovation / dw-kid2-graph-frontend-prototype

dw-kid2-graph-frontend-prototype.vercel.app
MIT License
0 stars 0 forks source link

Reinserting deleted documents results in Error 409 #26

Open nikonikoniko opened 2 years ago

nikonikoniko commented 2 years ago

When pouchdb/memory or pouchdb/idb are configured as the rxdb storage, then we cannot insert, delete, reinsert, and re-delete. The second deletion causes a 409 error from pouch, because the revision numbers no longer work. The problem has been isolated in repository https://github.com/nikonikoniko/rxdb-pouchdb-failing-revision-example where this is the code to reproduce the problem: https://github.com/nikonikoniko/rxdb-pouchdb-failing-revision-example/blob/main/src/index.js

The people at rxdb have been extremely responsive so far, and another user has created a pull request with the failing test for the same issue here: https://github.com/pubkey/rxdb/pull/3839

For now, we can move to a different storage backend when we need to re-add the entire document often.

nikonikoniko commented 2 years ago

Also consider replacing pouchdb/couchdb replication with graphQL replication: https://rxdb.info/replication-graphql.html

I believe that this should work while avoiding pouchdb completely and choosing a different frontend storage. This is also worth looking into and researching.

this is also relevant to #20

nikonikoniko commented 1 year ago

They have fixed the error in https://github.com/pubkey/rxdb/pull/3886