@@ -31,6 +31,11 @@ export default class AppUpdater {
3131
3232let mainWindow = null ;
3333
34+ // Disable caching resources to avoid unexpected behavior when exporting metadata.xml and resources
35+ // see https://github.com/electron/electron/issues/1720
36+ // and https://github.com/scramjs/scram-engine/issues/5#issuecomment-222323820
37+ app . commandLine . appendSwitch ( '--disable-http-cache' ) ;
38+
3439logHelpers . setupLogFile ( __dirname , 'debug' , 'error' ) ;
3540log . info ( 'Main App starting...' ) ;
3641
@@ -68,13 +73,6 @@ app.on('window-all-closed', () => {
6873} ) ;
6974
7075app . on ( 'ready' , async ( ) => {
71- if (
72- process . env . NODE_ENV === 'development' ||
73- process . env . DEBUG_PROD === 'true'
74- ) {
75- await installExtensions ( ) ;
76- }
77-
7876 mainWindow = new BrowserWindow ( {
7977 show : false ,
8078 width : 1024 ,
@@ -88,6 +86,20 @@ app.on('ready', async () => {
8886 `file://${ __dirname } /app.html#${ navigationConstants . NAVIGATION_WORKSPACES } `
8987 ) ;
9088
89+ /*
90+ waiting until 'dom-ready' avoids startup errors related to devtools server extension
91+ https://github.com/LN-Zap/zap-desktop/pull/500
92+ */
93+ mainWindow . webContents . on ( 'dom-ready' , async ( ) => {
94+ mainWindow . webContents . closeDevTools ( ) ;
95+ if (
96+ process . env . NODE_ENV === 'development' ||
97+ process . env . DEBUG_PROD === 'true'
98+ ) {
99+ await installExtensions ( ) ;
100+ }
101+ } ) ;
102+
91103 // @TODO : Use 'ready-to-show' event
92104 // https://github.com/electron/electron/blob/master/docs/api/browser-window.md#using-ready-to-show-event
93105 mainWindow . webContents . on ( 'did-finish-load' , ( ) => {
@@ -133,6 +145,7 @@ app.on('ready', async () => {
133145 mainWindow = null ;
134146 } ) ;
135147
148+ /*
136149 mainWindow.onerror = err => {
137150 // log.error(JSON.stringify(err));
138151 };
@@ -141,7 +154,6 @@ app.on('ready', async () => {
141154 // log.error(JSON.stringify(err));
142155 });
143156
144- /*
145157 session.defaultSession.webRequest.onErrorOccurred((details) => {
146158 log.error(JSON.stringify(details));
147159 });
0 commit comments