diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-08-15 23:27:17 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-08-15 23:27:17 +0200 |
commit | 78f885db3de3901e29c6841229df03327c2943fe (patch) | |
tree | 73736c1849a9226033d256055e057eda2a1d91d7 | |
parent | 61bc36b90aed99d161b28b9bc1742e7e1599546a (diff) |
missing structuredClone caused unintended mutations
-rw-r--r-- | packages/idb-bridge/package.json | 2 | ||||
-rw-r--r-- | packages/idb-bridge/src/MemoryBackend.ts | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json index 940f1747b..e69341c37 100644 --- a/packages/idb-bridge/package.json +++ b/packages/idb-bridge/package.json @@ -1,6 +1,6 @@ { "name": "idb-bridge", - "version": "0.0.1", + "version": "0.0.2", "description": "IndexedDB implementation that uses SQLite3 as storage", "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts index 9cdfd8a0e..d14d63a77 100644 --- a/packages/idb-bridge/src/MemoryBackend.ts +++ b/packages/idb-bridge/src/MemoryBackend.ts @@ -1027,7 +1027,7 @@ export class MemoryBackend implements Backend { if (!result) { throw Error("invariant violated"); } - values.push(result.value); + values.push(structuredClone(result.value)); } } } else { @@ -1086,7 +1086,7 @@ export class MemoryBackend implements Backend { } if (req.resultLevel >= ResultLevel.Full) { - values.push(res.value); + values.push(structuredClone(res.value)); } numResults++; @@ -1168,8 +1168,8 @@ export class MemoryBackend implements Backend { } const objectStoreRecord: ObjectStoreRecord = { - primaryKey: key, - value: value, + primaryKey: structuredClone(key), + value: structuredClone(value), }; objectStore.modifiedData = modifiedData.with(key, objectStoreRecord, true); |