From 43da260550d5e4d4c3fe053a575dda5b2fec552e Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 22 Jul 2024 21:43:54 -0300 Subject: [PATCH] Get defaultBoardBlackList from active communicator --- .../Communicator/Communicator.actions.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Communicator/Communicator.actions.js b/src/components/Communicator/Communicator.actions.js index aa817b10e..a16d899f2 100644 --- a/src/components/Communicator/Communicator.actions.js +++ b/src/components/Communicator/Communicator.actions.js @@ -249,12 +249,14 @@ export function getApiMyCommunicators() { } catch (e) { console.error(e); } - const activeCommunicator = - res.data.find( - communicator => - communicator.id === getState().communicator.activeCommunicator - ) ?? res.data[res.data.length - 1]; - const defaultBoardBlackList = activeCommunicator?.defaultBoardBlackList; + const getActiveCommunicator = getState => { + return getState().communicator.communicators.find( + c => c.id === getState().communicator.activeCommunicatorId + ); + }; + const activeCommunicator = getActiveCommunicator(getState); + const defaultBoardBlackList = + activeCommunicator?.defaultBoardBlackList ?? []; dispatch( removeBoardsFromList( defaultBoardBlackList,