Comments: Fix infinite loading when refreshing page (#2780)

This commit is contained in:
Alexander Zinchuk 2023-03-10 02:34:14 +01:00
parent e333b2db1b
commit 3e346aef53
2 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import {
safeReplaceViewportIds,
updateChats,
updateListedIds,
updateThread,
updateThread, updateThreadInfo,
updateThreadInfos,
updateUsers,
} from '../../reducers';
@ -161,6 +161,9 @@ async function loadAndReplaceMessages<T extends GlobalState>(global: T, actions:
global = addChatMessagesById(global, currentChatId, byId);
global = updateListedIds(global, currentChatId, activeThreadId, listedIds);
if (threadInfo?.originChannelId) {
global = updateThreadInfo(global, currentChatId, activeThreadId, threadInfo);
}
// eslint-disable-next-line @typescript-eslint/no-loop-func
Object.values(global.byTabId).forEach(({ id: otherTabId }) => {
const { chatId: otherChatId, threadId: otherThreadId } = selectCurrentMessageList(global, otherTabId) || {};

View File

@ -15,7 +15,6 @@ import { Bundles, loadBundle } from '../util/moduleLoader';
import { getCurrentTabId, reestablishMasterToSelf } from '../util/establishMultitabRole';
import { updateTabState } from './reducers/tabs';
import type { ActionReturnType, GlobalState } from './types';
import { getIsMobile } from '../hooks/useAppLayout';
import { isLocalMessageId } from './helpers';
initCache();
@ -114,7 +113,7 @@ addActionHandler('init', (global, actions, payload): ActionReturnType => {
};
});
const parsedMessageList = !getIsMobile() ? parseLocationHash() : undefined;
const parsedMessageList = parseLocationHash();
if (global.authState !== 'authorizationStateReady'
&& !global.passcode.hasPasscode && !global.passcode.isScreenLocked) {