Skip to content

Commit

Permalink
fix: solve issue where a white screen was displayed on app startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed Sep 14, 2020
1 parent c82afa8 commit 52f63a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions main/openFile.ts → main/createOpenFileHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { dialog, IpcMain } from 'electron';
import { dialog } from 'electron';

export default function createOpenFile(
ipcMain: IpcMain,
export default function createOpenFileHandler(
createWindow: (file?: string) => void,
) {
const openFile = async () => {
Expand All @@ -15,6 +14,5 @@ export default function createOpenFile(
filePaths.forEach(createWindow);
};

ipcMain.handle('MENU_FILE_OPEN', openFile);
return openFile;
}
6 changes: 4 additions & 2 deletions main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
systemPreferences,
} from 'electron';
import createWindowManager from './windowManager';
import createOpenFile from './openFile';
import createOpenFile from './createOpenFileHandler';
import disableUnused from './disableUnused';
import { createDefaultMenu } from './defaultMenu';
import registerSave from './registerSave';
Expand All @@ -26,7 +26,8 @@ export default function main() {
const settings = getSettings();
const windowManager = createWindowManager(app, ipcMain, settings);
windowManager.init();
const openFile = createOpenFile(ipcMain, windowManager.createWindow);

const openFile = createOpenFile(windowManager.createWindow);
const defaultMenu = createDefaultMenu(
windowManager.createWindow,
openFile,
Expand All @@ -35,6 +36,7 @@ export default function main() {
registerSave(ipcMain, windowManager);
moneymoneyHandlers(ipcMain);

ipcMain.handle('MENU_FILE_OPEN', openFile);
nativeTheme.on('updated', () => {
windowManager.broadcast('UPDATE_SCHEME');
});
Expand Down
2 changes: 1 addition & 1 deletion main/windowManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function createWindowManager(
win.loadURL(`${SERVER_URL}#${hash}`);
win.webContents.openDevTools();
} else {
win.loadFile(join(__dirname, `../build/index.html#${hash}`));
win.loadFile(join(__dirname, '../build/index.html'), { hash });
}

broadcast('WINDOW_CREATED');
Expand Down

0 comments on commit 52f63a0

Please sign in to comment.