Closed natew closed 6 years ago
Hm strange. Looks like this has something to do with the primary-key. Please post your schema.
{
"primaryPath": "_id",
"disableKeyCompression": true,
"properties": {
"id": {
"primary": true,
"type": "string"
},
"title": {
"index": true,
"type": "string"
},
"integration": {
"type": "string"
},
"type": {
"index": true,
"type": "string"
},
"bodyTEMP": {
"type": "string"
},
"data": {
"type": "object"
},
"parentId": {
"type": "string"
},
"author": {
"type": "string"
},
"created": {
"index": true,
"type": "string"
},
"updated": {
"index": true,
"type": "string"
},
"orgName": {
"type": "string"
},
"bucket": {
"type": "string"
},
"url": {
"unique": true,
"type": "string"
},
"createdAt": {
"format": "date-time",
"type": "string",
"index": true
},
"updatedAt": {
"format": "date-time",
"type": "string",
"index": true
}
},
"type": "object",
"required": [
"title",
"integration",
"type",
"created",
"updated"
],
"title": "things",
"version": 0
}
Testing this in browser and I haven't triggered it after a few tries now.
Weirdly though I'm not seeing .remove()
sync across tabs until refresh. Insert seems to sync just fine.
I should have noted I'm not on the latest RxDB, using 6.0.1
until I get a chance to fix bundling on 7.
Can you disable the QueryChangeDetector and check if it works then?
Ah good point.
Test results from that:
Chrome + QueryChangeDetector = Delete doesn't propogate across tabs (insert does) Electron + QueryChangeDetector = Delete throws error above (with sort)
Disabled querychange and now:
Electron seems to be fine, the bug above isn't replicating. Browser was working for a moment where remove and update were fine, but now:
Re-enabled it and the first electron bug went away, so not sure whats going on there. Second delete sync issue is still there:
https://v.usetapes.com/y0DbIRQuVs
The document conflict seems interesting, perhaps I'm not clearing them properly all the way. Double checking that...
I tried to reproduce. One thing: You have an error in the code
const all = await collection.find()
should be
const all = await collection.find().exec()
Hi @natew I'm sorry but I won't fix this. I spend much time to reproduce and fix this, but I can't. I basically comes down to the following problem: When you create multiple pouchdb-instances on the same adapter and then do many deletes on one instance while at the same time doing many queries on the other instance, it breaks. I also created a branch for this issue and created this test which shows what does not work on plain pouchdb-instances.
This is a pouchdb-issue and should be solved there. I think there is a way to monkeypatch this on rxdb, but there is still a missing way to reproduce the error you got on the linked video. (The test produces another, but similar error).
It would be nice if you have the time to create a failing test which creates your specific error.
Case
Need to narrow this down a bit better as it happens in a complex area. Basic gist of it is this:
Issue
When you delete all entries like so:
You get this:
I can reproduce it by having a function that clears all things and re-creates them again. Let me know if this doesn't ring any bells I can get a better sourcemap / schema / etc.