From 87a4c3f449830a74cde16378891b67d01991821e Mon Sep 17 00:00:00 2001 From: liuhaibin0528 Date: Wed, 3 Jun 2026 12:50:08 +0800 Subject: [PATCH] fix: handle undefined manifest value in loadShardedData When kv.get() returns undefined for a non-existent key, the strict comparison (manifest.value !== null) evaluates to true, causing undefined to be passed to loadManifestData which crashes with 'Cannot read properties of undefined (reading "v")'. Change to loose comparison (manifest.value != null) to catch both null and undefined, allowing the function to fall through to the legacy data path as intended. Fixes: sharded index crash on old data format --- src/state/index-persistence.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state/index-persistence.ts b/src/state/index-persistence.ts index 9c9fd61a..2efbe4e2 100644 --- a/src/state/index-persistence.ts +++ b/src/state/index-persistence.ts @@ -358,7 +358,7 @@ export class IndexPersistence { "manifest", ); if (!manifest.ok) return null; - if (manifest.value !== null) { + if (manifest.value != null) { return this.loadManifestData(manifest.value, label); }