From 2f17eefba1cf440d9be14fe88364f98aa3078bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 26 Sep 2024 23:38:16 +0200 Subject: [PATCH] pl-fe: avoiding processing the same account multiple times MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/actions/importer/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/pl-fe/src/actions/importer/index.ts b/packages/pl-fe/src/actions/importer/index.ts index 169958c73..0cc2e8ccc 100644 --- a/packages/pl-fe/src/actions/importer/index.ts +++ b/packages/pl-fe/src/actions/importer/index.ts @@ -111,7 +111,7 @@ const isBroken = (status: BaseStatus) => { }; const importFetchedStatuses = (statuses: Array & { account: BaseAccount | null }>) => (dispatch: AppDispatch) => { - const accounts: Array = []; + const accounts: Record = {}; const normalStatuses: Array = []; const polls: Array = []; @@ -122,7 +122,7 @@ const importFetchedStatuses = (statuses: Array & { a normalStatuses.push(status); - if (status.account !== null) accounts.push(status.account); + accounts[status.account.id] = status.account; // if (status.accounts) { // accounts.push(...status.accounts); // } @@ -144,7 +144,7 @@ const importFetchedStatuses = (statuses: Array & { a (statuses as Array).forEach(processStatus); dispatch(importPolls(polls)); - dispatch(importFetchedAccounts(accounts)); + dispatch(importFetchedAccounts(Object.values(accounts))); dispatch(importStatuses(normalStatuses)); };