missing structuredClone caused unintended mutations
This commit is contained in:
parent
61bc36b90a
commit
78f885db3d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "idb-bridge",
|
"name": "idb-bridge",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"description": "IndexedDB implementation that uses SQLite3 as storage",
|
"description": "IndexedDB implementation that uses SQLite3 as storage",
|
||||||
"main": "./build/index.js",
|
"main": "./build/index.js",
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
@ -1027,7 +1027,7 @@ export class MemoryBackend implements Backend {
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
throw Error("invariant violated");
|
throw Error("invariant violated");
|
||||||
}
|
}
|
||||||
values.push(result.value);
|
values.push(structuredClone(result.value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1086,7 +1086,7 @@ export class MemoryBackend implements Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.resultLevel >= ResultLevel.Full) {
|
if (req.resultLevel >= ResultLevel.Full) {
|
||||||
values.push(res.value);
|
values.push(structuredClone(res.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
numResults++;
|
numResults++;
|
||||||
@ -1168,8 +1168,8 @@ export class MemoryBackend implements Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const objectStoreRecord: ObjectStoreRecord = {
|
const objectStoreRecord: ObjectStoreRecord = {
|
||||||
primaryKey: key,
|
primaryKey: structuredClone(key),
|
||||||
value: value,
|
value: structuredClone(value),
|
||||||
};
|
};
|
||||||
|
|
||||||
objectStore.modifiedData = modifiedData.with(key, objectStoreRecord, true);
|
objectStore.modifiedData = modifiedData.with(key, objectStoreRecord, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user