diff --git a/packages/extension-polkagate/src/fullscreen/accountDetails/components/TotalChart.tsx b/packages/extension-polkagate/src/fullscreen/accountDetails/components/TotalChart.tsx index 50e49e889..75dc51607 100644 --- a/packages/extension-polkagate/src/fullscreen/accountDetails/components/TotalChart.tsx +++ b/packages/extension-polkagate/src/fullscreen/accountDetails/components/TotalChart.tsx @@ -113,7 +113,7 @@ export default function TotalChart({ accountAssets, pricesInCurrency }: Props): return () => { chartInstance.destroy(); }; - }, [assets, theme.palette.divider]); + }, [assets?.length, theme.palette.divider]); return ( diff --git a/packages/extension-ui/src/Popup/index.tsx b/packages/extension-ui/src/Popup/index.tsx index a6055bb03..84fd7dbf4 100644 --- a/packages/extension-ui/src/Popup/index.tsx +++ b/packages/extension-ui/src/Popup/index.tsx @@ -152,8 +152,8 @@ export default function Popup(): React.ReactElement { }, []); useEffect(() => { - assetsOnChains && setAccountsAssets(assetsOnChains); - }, [assetsOnChains]); + assetsOnChains && setAccountsAssets({...assetsOnChains}); + }, [assetsOnChains?.timeStamp]); useEffect(() => { /** remove forgotten accounts from assetChains if any */ @@ -161,11 +161,13 @@ export default function Popup(): React.ReactElement { Object.keys(assetsOnChains.balances).forEach((_address) => { const found = accounts.find(({ address }) => address === _address); - !found && delete assetsOnChains.balances[_address]; - setStorage(ASSETS_NAME_IN_STORAGE, assetsOnChains, true).catch(console.error); + if (!found) { + delete assetsOnChains.balances[_address]; + setStorage(ASSETS_NAME_IN_STORAGE, assetsOnChains, true).catch(console.error); + } }); } - }, [accounts, assetsOnChains]); + }, [accounts?.length, assetsOnChains?.timeStamp]); useEffect(() => { if (priceIds && currency?.code && !isFetchingPricesRef.current) {