Multitabs: Fix broken app when multitabs are not supported (#2642)

This commit is contained in:
Alexander Zinchuk 2023-02-21 21:27:42 +01:00
parent b898b0856b
commit 7bcbae4e0d

View File

@ -3,6 +3,7 @@ import {
} from './index';
import { INITIAL_GLOBAL_STATE, INITIAL_TAB_STATE } from './initialState';
import { IS_MULTITAB_SUPPORTED } from '../util/environment';
import { IS_MOCKED_CLIENT } from '../config';
import { initCache, loadCache } from './cache';
import { cloneDeep } from '../util/iteratees';
@ -62,8 +63,8 @@ addActionHandler('init', (global, actions, payload): ActionReturnType => {
},
};
if (isMasterTab) {
initialTabState.isMasterTab = isMasterTab;
if (isMasterTab || !IS_MULTITAB_SUPPORTED) {
initialTabState.isMasterTab = true;
}
Object.keys(global.messages.byChatId).forEach((chatId) => {
@ -122,6 +123,10 @@ addActionHandler('init', (global, actions, payload): ActionReturnType => {
});
}
if (!IS_MULTITAB_SUPPORTED) {
actions.initApi();
}
return updateTabState(global, {
messageLists: parsedMessageList ? [parsedMessageList] : initialTabState.messageLists,
}, tabId);