[MM-48079] Fix race condition related to registry loading vs. the welcome screen popup (#2408)
This commit is contained in:
@@ -4,10 +4,11 @@
|
|||||||
import {app, dialog, IpcMainEvent, IpcMainInvokeEvent, Menu} from 'electron';
|
import {app, dialog, IpcMainEvent, IpcMainInvokeEvent, Menu} from 'electron';
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
|
|
||||||
import {Team, TeamWithIndex} from 'types/config';
|
import {Team, TeamWithIndex, RegistryConfig as RegistryConfigType} from 'types/config';
|
||||||
import {MentionData} from 'types/notification';
|
import {MentionData} from 'types/notification';
|
||||||
|
|
||||||
import Config from 'common/config';
|
import Config from 'common/config';
|
||||||
|
import {REGISTRY_READ_EVENT} from 'common/config/RegistryConfig';
|
||||||
import {getDefaultTeamWithTabsFromTeam} from 'common/tabs/TabView';
|
import {getDefaultTeamWithTabsFromTeam} from 'common/tabs/TabView';
|
||||||
import {ping} from 'common/utils/requests';
|
import {ping} from 'common/utils/requests';
|
||||||
|
|
||||||
@@ -87,6 +88,8 @@ export function handleOpenTab(event: IpcMainEvent, serverName: string, tabName:
|
|||||||
|
|
||||||
export function handleShowOnboardingScreens(showWelcomeScreen: boolean, showNewServerModal: boolean, mainWindowIsVisible: boolean) {
|
export function handleShowOnboardingScreens(showWelcomeScreen: boolean, showNewServerModal: boolean, mainWindowIsVisible: boolean) {
|
||||||
log.debug('Intercom.handleShowOnboardingScreens', {showWelcomeScreen, showNewServerModal, mainWindowIsVisible});
|
log.debug('Intercom.handleShowOnboardingScreens', {showWelcomeScreen, showNewServerModal, mainWindowIsVisible});
|
||||||
|
|
||||||
|
const showWelcomeScreenFunc = () => {
|
||||||
if (showWelcomeScreen) {
|
if (showWelcomeScreen) {
|
||||||
handleWelcomeScreenModal();
|
handleWelcomeScreenModal();
|
||||||
return;
|
return;
|
||||||
@@ -94,6 +97,17 @@ export function handleShowOnboardingScreens(showWelcomeScreen: boolean, showNewS
|
|||||||
if (showNewServerModal) {
|
if (showNewServerModal) {
|
||||||
handleNewServerModal();
|
handleNewServerModal();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (process.platform === 'win32' && !Config.registryConfigData) {
|
||||||
|
Config.registryConfig.once(REGISTRY_READ_EVENT, (data: Partial<RegistryConfigType>) => {
|
||||||
|
if (data.teams?.length === 0) {
|
||||||
|
showWelcomeScreenFunc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
showWelcomeScreenFunc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleMainWindowIsShown() {
|
export function handleMainWindowIsShown() {
|
||||||
|
Reference in New Issue
Block a user