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) ?? [[]];