-
Notifications
You must be signed in to change notification settings - Fork 27
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
incoming transform :: document updates are not live replicated #8
Comments
@nolanlawson Do you have any thoughts on this? Are we mis-using transform/replication somehow? |
I admit I'm having trouble understanding your example. The incoming/outgoing functions are supposed to be purely synchronous; they aren't supposed to have side effects. What kinds of real-world cases would cause this error? And what is the error exactly? |
In the real world, we have a local DB (in browser) live replicating from a remote DB (https). Without transform-pouch, we see updates arriving as we'd expect. With transform-pouch, however, it's a different story. Our db.transform call is as follows: // Monitor changes to localDB
localDB.transform({
incoming: function(doc) {
console.log("INCOMING document: ", doc);
return doc;
},
outgoing: function(doc) {
console.log("OUTGOING document: ", doc);
return doc;
}
}); This function is just a precursor to our eventual function, but we're testing transform-pouch has no side-effects, first! If db.transform() is called, we see strange behaviour where the local DB doesn't receive updated documents. We still receive new documents, but no changes to those documents are persisted. This test case shows the issue. |
Linked to PR (above) to show issue. No longer a single commit. |
@nolanlawson Does my explanation make sense, or are we doing something fundamentally wrong here? |
To be honest I just don't understand your test. If you provide a fix, though, and if Travis is green, then I will accept it gladly. :) |
Sadly, conversely I don't think I understand the code enough to fix that :-). Will see if I can find a way to get our respective understandings to meet in the middle! Perhaps the test case could do with simplification. Or more comments. I will take a look. |
Hi guys, I have the same problem with crypto-pouch which I've just found out it relies on transform-pouch. Scenario as follow: A list of documents in cloudant encrypted with crypto-pouch and live replicated with pouchdb Device1 Device2 Device1 Device2 Device1 Device2 Device1 is still with revX If I disable the crypto-pouch it comes back to normal all replications are working. ###Sample #####contacts-providers.ts
Good luck with this one. |
@numerized Not quite what I see, because my app doesn't make local updates to existing documents. IIRC it does however, create others. Do you see the same pattern with local updates/creates to a docB document? |
(Full disclosure - had to abandon transform-pouch for my usecase) |
If you could provide a live test case I could still take a look at this, but based on the description here it's unclear to me what's going on. |
HI @nolanlawson sorry got really busy on many things... I'll definitely give crypto-pouch a try in the next few weeks. I was thinking about it and in my cas I might have found that wkwebview plugin was the reason I had the live-sync to fail from two different devices after updating the document in both sides one after the other. I'll try it better and report |
Per commentary elsewhere (e.g. #56) it's possible this is related to |
I've noticed that the act of attaching transform-pouch to a DB breaks live replication, specifically in the case where an existing document is updated. Creates are fine.
I don't know how to fix this, but I have managed to recreate within the transform-pouch test harness. I've included the test case in my local branch (see linked PR).
Test case may be over-complicated; apologies.
The text was updated successfully, but these errors were encountered: