From 2732e701f5a130fe47d69b1196bf360626e12aa3 Mon Sep 17 00:00:00 2001 From: Paul Tran-Van Date: Mon, 21 Oct 2024 14:53:09 +0200 Subject: [PATCH] refactor: Better readability --- src/dataproxy/worker/shared-worker.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/dataproxy/worker/shared-worker.ts b/src/dataproxy/worker/shared-worker.ts index 961de13..9bf3460 100644 --- a/src/dataproxy/worker/shared-worker.ts +++ b/src/dataproxy/worker/shared-worker.ts @@ -85,13 +85,12 @@ const updateState = (): void => { if (client && searchEngine && searchEngine.searchIndexes) { state.status = 'Ready' - state.indexLength = Object.keys(searchEngine.searchIndexes).map( - (indexKey: string) => ({ - doctype: indexKey, + state.indexLength = Object.entries(searchEngine.searchIndexes).map( + ([doctype, searchIndex]) => ({ + doctype, // @ts-expect-error index.store is not TS typed // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - count: Object.keys(searchEngine.searchIndexes[indexKey].index.store) - .length + count: Object.keys(searchIndex.index.store).length }) ) broadcastChannel.postMessage(state)