From 950ef891f4f98fc52cab340705bac3a2fa491db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4f?= Date: Wed, 14 Feb 2024 08:54:44 +0100 Subject: [PATCH] wip --- src/services/IndexedDbPersistenceService.ts | 32 +++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/services/IndexedDbPersistenceService.ts b/src/services/IndexedDbPersistenceService.ts index c86bb66f..a53419b2 100644 --- a/src/services/IndexedDbPersistenceService.ts +++ b/src/services/IndexedDbPersistenceService.ts @@ -562,24 +562,20 @@ class IndexedDbPersistenceService implements PersistenceService { const allWindows: Window[] = await this.db.getAll('windows') as Window[] console.log(`adding ${window.toString()} to list [${_.join(_.map(allWindows, w => w.id), ',')}]`) for (const w of allWindows) { - console.log("comparing hostLists", window.hostList, w.hostList, typeof w.hostList) - const intersection = new Set([...window.hostList].filter(x => (new Set(w.hostList).has(x)))); - console.log("intersection", intersection, intersection.size === window.hostList.length, intersection.size === w.hostList.length) - if (intersection.size === window.hostList.length && intersection.size === w.hostList.length) { - // reuse existing - const useId = window.id - const oldId = w.id - window = w - window.id = useId - console.warn("replacing old window " + oldId + " with " + window.toString()) - - // logtail.warn("tabsets started", { - // "mode": process.env.MODE, - // "version": import.meta.env.PACKAGE_VERSION, - // }) - - await this.db.delete('windows', oldId) - break + if (w.hostList) { + console.log("comparing hostLists", window.hostList, w.hostList, typeof w.hostList) + const intersection = new Set([...window.hostList].filter(x => (new Set(w.hostList).has(x)))); + console.log("intersection", intersection, intersection.size === window.hostList.length, intersection.size === w.hostList.length) + if (intersection.size === window.hostList.length && intersection.size === w.hostList.length) { + // reuse existing + const useId = window.id + const oldId = w.id + window = w + window.id = useId + console.warn("replacing old window " + oldId + " with " + window.toString()) + await this.db.delete('windows', oldId) + break + } } } //}