Electron 11 only shows Web Content after resize, minimize or drag Main Window
See original GitHub issueDescribe the bug I’m building an app with Electron, Capacitor, Ionic and Angular.
My app runs smooth without any problems if I use electron version 10.2.0, but if I upgrade to Electron 11.2.0 my app starts with an empty white screen. The strange thing is, if I inspect the page the HTML is there but the window shows only white (black if dark mode). My apps starts displaying if I do one of the following:
- Resize the app window
- Move the window;
- Minimize or maximize the window;
- Run for example a registered shortcut command (CTRL + H for a MessageBox with App help screen);
It looks like the main windows looses focus or stops to render, but then when I click, min/max the windows or drag it gain focus and continuous to render… I already tried to force focus without success.
MainWindow.focus();
Any hint on what may be causing this?
To Reproduce Update to Electron from 10.2.0 or 10.3.0 to 11.2.0.
Expected behavior App should run without the need to resize, move or minimize/maximize the window.
Screenshots App shows nothing until something is done with the window (drag, min/max, loose focus, etc).
Desktop (please complete the following information):
- OS: Windows 10
- Browser Electron 11.2.0
- Capacitor 2.4.6
- Capacitor Electron 1.3.2
Additional context If I try to force MainWindow.show(); in my main.ts after the app inits it shows and render the web page, but it breaks the splashcreen, showing an white area (same as the window size) around the splashscreen image…
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
I pushed out a platform update (v1.3.3) that reverts back to electron ~10.3.1 so new users wont have a ton of frustrations. I will keep this issue open until the issue is resolved.
If you need electron versions >10, then you can freely update it manually in your project.
Open a terminal in the electron folder of your project and just use
npm i electron@^XX.XX.XX
with your required version. Sam goes for needing to downgrade for any reason too.I am somehow still seeing this issue on 4.1.0 version. with Electron 14. when I set
hideMainWindowOnLaunch
to true, its even worse and no window will show up after splash screen is hidden. Even thought I can see logs from both renderer and main processes running normally in the background. Just the window has issues to show up.for now setting the timeout for
this.MainWindow.show()
solves this.