mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-02 06:39:46 +08:00
fix(electron): main window should be opened first before destroying onboard window (#5319)
The issue listed on the title will prevent main window from showing on windows.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { logger } from '../logger';
|
||||
import { initMainWindow } from '../main-window';
|
||||
import {
|
||||
getOnboardingWindow,
|
||||
@@ -8,19 +9,19 @@ import { launchStage } from './stage';
|
||||
/**
|
||||
* Launch app depending on launch stage
|
||||
*/
|
||||
export function launch() {
|
||||
export async function launch() {
|
||||
const stage = launchStage.value;
|
||||
if (stage === 'main') {
|
||||
initMainWindow().catch(e => {
|
||||
console.error('Failed to restore or create window:', e);
|
||||
logger.error('Failed to restore or create window:', e);
|
||||
});
|
||||
|
||||
getOnboardingWindow()
|
||||
.then(w => w?.destroy())
|
||||
.catch(e => console.error('Failed to destroy onboarding window:', e));
|
||||
.catch(e => logger.error('Failed to destroy onboarding window:', e));
|
||||
}
|
||||
if (stage === 'onboarding')
|
||||
getOrCreateOnboardingWindow().catch(e => {
|
||||
console.error('Failed to restore or create onboarding window:', e);
|
||||
logger.error('Failed to restore or create onboarding window:', e);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user