diff --git a/index.html b/index.html index 6b5011a..57625b5 100644 --- a/index.html +++ b/index.html @@ -630,10 +630,6 @@ case 'dashboard': renderRecentTransactions() refreshBalance() - if(accountChart){ - accountChart.destroy() - } - accountChart = renderChart() break; case 'notifications': if(pagesData.openedSubPages.includes(subPageId)){ @@ -1030,6 +1026,15 @@ }); } + const chartObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { + if(entry.isIntersecting){ + accountChart = renderChart() + }else if(!entry.isIntersecting && accountChart){ + accountChart.destroy() + } + }) + })