Monetization: Fix Tab reset (#5101)

This commit is contained in:
Alexander Zinchuk 2024-11-02 21:11:46 +04:00
parent e40a91ca7d
commit 6ab84ff12f
2 changed files with 11 additions and 1 deletions

View File

@ -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';

View File

@ -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 && {