From 423e0854d383b0d34791c7902b54bf3b9c270d75 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 9 Mar 2023 12:10:37 -0600 Subject: [PATCH] Fix #17848 - Ensure NFT collections toggle appropriately (#17972) --- ui/components/app/nfts-items/nfts-items.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/components/app/nfts-items/nfts-items.js b/ui/components/app/nfts-items/nfts-items.js index d84616820..e2ce133d7 100644 --- a/ui/components/app/nfts-items/nfts-items.js +++ b/ui/components/app/nfts-items/nfts-items.js @@ -106,17 +106,19 @@ export default function NftsItems({ }; const updateNftDropDownStateKey = (key, isExpanded) => { - const currentAccountNftDropdownState = - nftsDropdownState[selectedAddress][chainId]; - const newCurrentAccountState = { - ...currentAccountNftDropdownState, + ...nftsDropdownState[selectedAddress][chainId], [key]: !isExpanded, }; - nftsDropdownState[selectedAddress][chainId] = newCurrentAccountState; + const newState = { + ...nftsDropdownState, + [selectedAddress]: { + [chainId]: newCurrentAccountState, + }, + }; - dispatch(updateNftDropDownState(nftsDropdownState)); + dispatch(updateNftDropDownState(newState)); }; const renderCollection = ({ nfts, collectionName, collectionImage, key }) => {