Connection: Fix reconnect logic being called on sync (#3840)

This commit is contained in:
Alexander Zinchuk 2023-09-13 12:21:43 +02:00
parent fb614840f6
commit aa2c065eef

View File

@ -221,6 +221,7 @@ function onUpdateConnectionState<T extends GlobalState>(
}; };
setGlobal(global); setGlobal(global);
if (global.isSynced) {
const channelStackIds = Object.values(global.byTabId) const channelStackIds = Object.values(global.byTabId)
.flatMap((tab) => tab.messageLists) .flatMap((tab) => tab.messageLists)
.map((messageList) => messageList.chatId) .map((messageList) => messageList.chatId)
@ -233,6 +234,7 @@ function onUpdateConnectionState<T extends GlobalState>(
actions.requestChannelDifference({ chatId }); actions.requestChannelDifference({ chatId });
}); });
} }
}
if (connectionState === 'connectionStateBroken') { if (connectionState === 'connectionStateBroken') {
actions.signOut({ forceInitApi: true }); actions.signOut({ forceInitApi: true });