You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you modify the Uint8Array that getAttachment() returns, the data inside the (in-memory) DB gets changed too.
This was unexpected, and I believe it is different to the way normal PouchDB behaves.
I've shown some code below to demonstrate the problem. I think a simple fix is to run it through a Uint8Array constructor.
const blob = new Uint8Array( await db.getAttachment(id, fname) )
I was originally going to say this just needs to be written in the docs... but as I've been writing this up, if the point of the pouchdb-memory adapter is to simulate the real thing, then maybe the above code snippet belongs in getAttachment() ?
If you modify the
Uint8Array
thatgetAttachment()
returns, the data inside the (in-memory) DB gets changed too.This was unexpected, and I believe it is different to the way normal PouchDB behaves.
I've shown some code below to demonstrate the problem. I think a simple fix is to run it through a
Uint8Array
constructor.I was originally going to say this just needs to be written in the docs... but as I've been writing this up, if the point of the pouchdb-memory adapter is to simulate the real thing, then maybe the above code snippet belongs in
getAttachment()
?The text was updated successfully, but these errors were encountered: