From 25a97e5732d515d842a73302569c7f15b901290d Mon Sep 17 00:00:00 2001 From: Zhenyang Hua Date: Mon, 12 Apr 2021 22:03:15 -0400 Subject: [PATCH 1/2] Point to the correct start and end indices --- addons/dexie-export-import/src/tson.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dexie-export-import/src/tson.ts b/addons/dexie-export-import/src/tson.ts index 026155652..419b35568 100644 --- a/addons/dexie-export-import/src/tson.ts +++ b/addons/dexie-export-import/src/tson.ts @@ -71,7 +71,7 @@ TSON.finalize = async (items?: any[]) => { const typeSpec = TSON.types[typeName]; if (typeSpec && typeSpec.finalize) { const b = Dexie.getByKeyPath(item, arrayType ? "$." + keyPath : keyPath); - typeSpec.finalize(b, allChunks.slice(b.start, b.end)); + typeSpec.finalize(b, allChunks.slice(b.data?.start, b.data?.end)); } } } From 35bdb11403fadf0e64e1cc5d1a2022540e5ebd58 Mon Sep 17 00:00:00 2001 From: Zhenyang Hua Date: Fri, 23 Apr 2021 20:55:33 -0400 Subject: [PATCH 2/2] disabled blobs reset --- addons/dexie-export-import/src/tson.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/dexie-export-import/src/tson.ts b/addons/dexie-export-import/src/tson.ts index 419b35568..9fc3adc8e 100644 --- a/addons/dexie-export-import/src/tson.ts +++ b/addons/dexie-export-import/src/tson.ts @@ -78,5 +78,8 @@ TSON.finalize = async (items?: any[]) => { } } // Free up memory - blobsToAwait = []; + // Todo - this is the problematic one that causes the blobs to be reset everytime the `finalize` is + // called, where the chunks slicing are happening, which causes the data slicing with the wrong indices. + // need to figure out a different way to GC. + // blobsToAwait = []; }