summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-17 01:50:51 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-17 01:50:51 +0200
commit9e3a26ca70e77265f74527eb183c3f80b6531a97 (patch)
tree88d3cde839611aabf3f7289bb05764561a2cc56b /packages
parentd947b90df330d8e3598fd95ccacb8d511923ead8 (diff)
downloadwallet-core-9e3a26ca70e77265f74527eb183c3f80b6531a97.tar.gz
wallet-core-9e3a26ca70e77265f74527eb183c3f80b6531a97.tar.bz2
wallet-core-9e3a26ca70e77265f74527eb183c3f80b6531a97.zip
idb-bridge: fix bug in index deletion
Diffstat (limited to 'packages')
-rw-r--r--packages/idb-bridge/src/MemoryBackend.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts
index a47c0a136..b5087b862 100644
--- a/packages/idb-bridge/src/MemoryBackend.ts
+++ b/packages/idb-bridge/src/MemoryBackend.ts
@@ -244,6 +244,9 @@ export class MemoryBackend implements Backend {
* been made.
*/
importDump(data: any) {
+ if (this.enableTracing) {
+ console.log("importing dump (a)");
+ }
if (this.transactionIdCounter != 1 || this.connectionIdCounter != 1) {
throw Error(
"data must be imported before first transaction or connection",
@@ -326,6 +329,7 @@ export class MemoryBackend implements Backend {
* Only exports data that has been committed.
*/
exportDump(): MemoryBackendDump {
+ this.enableTracing && console.log("exporting dump");
const dbDumps: { [name: string]: DatabaseDump } = {};
for (const dbName of Object.keys(this.databases)) {
const db = this.databases[dbName];
@@ -873,12 +877,12 @@ export class MemoryBackend implements Backend {
throw Error("assertion failed");
}
-
for (const indexName of Object.keys(schema.objectStores[objectStoreName].indexes)) {
const index = myConn.objectStoreMap[objectStoreName].indexMap[indexName];
if (!index) {
throw Error("index referenced by object store does not exist");
}
+ this.enableTracing && console.log(`deleting from index ${indexName} for object store ${objectStoreName}`);
const indexProperties = schema.objectStores[objectStoreName].indexes[indexName];
this.deleteFromIndex(
index,
@@ -925,7 +929,7 @@ export class MemoryBackend implements Backend {
x => compareKeys(x, primaryKey) !== 0,
);
if (newPrimaryKeys.length === 0) {
- index.originalData = indexData.without(indexKey);
+ index.modifiedData = indexData.without(indexKey);
} else {
const newIndexRecord = {
indexKey,