From 9f38df342f8e3313e8b95c19e1fbe986a0e76d43 Mon Sep 17 00:00:00 2001 From: sjh00 Date: Mon, 20 Oct 2025 13:53:24 +0800 Subject: [PATCH] fix: PageCollector -> TypeError: Cannot set properties of undefined --- src/PageCollector.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PageCollector.ts b/src/PageCollector.ts index b6b3d679..f7a81446 100644 --- a/src/PageCollector.ts +++ b/src/PageCollector.ts @@ -91,7 +91,12 @@ export class PageCollector { this.storage.set(page, storedLists); const listeners = this.#listenersInitializer(value => { - const withId = value as WithSymbolId; + let withId: WithSymbolId; + if (value === undefined || value === null) { + withId = {} as WithSymbolId; + } else { + withId = value as WithSymbolId; + } withId[stableIdSymbol] = idGenerator(); const navigations = this.storage.get(page) ?? [[]];