diff --git a/src/components/right/statistics/MonetizationStatistics.tsx b/src/components/right/statistics/MonetizationStatistics.tsx index 611e987dd..66c141a83 100644 --- a/src/components/right/statistics/MonetizationStatistics.tsx +++ b/src/components/right/statistics/MonetizationStatistics.tsx @@ -104,11 +104,20 @@ const MonetizationStatistics = ({ return; } + if (containerRef.current) { + Array.from(containerRef.current.children).forEach((child) => { + child.innerHTML = ''; + child.classList.add(styles.hidden); + }); + } + + loadedCharts.current = []; + if (!statistics || !containerRef.current) { return; } - MONETIZATION_GRAPHS.filter(Boolean).forEach((name, index: number) => { + MONETIZATION_GRAPHS.forEach((name, index: number) => { const graph = statistics[name as keyof typeof statistics]; const isAsync = typeof graph === 'string'; diff --git a/src/global/actions/ui/chats.ts b/src/global/actions/ui/chats.ts index 7a8f189d5..5e2e13469 100644 --- a/src/global/actions/ui/chats.ts +++ b/src/global/actions/ui/chats.ts @@ -63,6 +63,7 @@ addActionHandler('processOpenChatOrThread', (global, actions, payload): ActionRe global = updateTabState(global, { isStatisticsShown: false, + monetizationStatistics: undefined, boostStatistics: undefined, contentToBeScheduled: undefined, ...(chatId !== selectTabState(global, tabId).forwardMessages.toChatId && {