Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theia app is not loading while minimized at startup #13798

Open
rschnekenbu opened this issue Jun 11, 2024 · 16 comments · May be fixed by #13887
Open

Theia app is not loading while minimized at startup #13798

rschnekenbu opened this issue Jun 11, 2024 · 16 comments · May be fixed by #13887

Comments

@rschnekenbu
Copy link
Contributor

When minimizing the window of a Theia based electron application at startup, the loading of the application seems suspended until the window is restored. It can be expected here that the window is still loading despite being minimized.

@msujew
Copy link
Member

msujew commented Jun 11, 2024

I believe this is a general Theia frontend issue, it's actually fairly easily reproducible in the browser version as well: I've noticed that if I restart the backend and have the frontend open in an inactive tab, it only actually loads the frontend when I switch to the browser tab.

@rschnekenbu rschnekenbu changed the title Theia electron app is not loading when minimized at startup Theia app is not loading when minimized at startup Jun 11, 2024
@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

I tried to reproduce this, but could not. Is there a particular sequence of actions to make it happen?

@rschnekenbu
Copy link
Contributor Author

I could reproduce on my side on Linux, using Theia IDE. I start the application from the command line.
In some conditions, I get the splash screen and the main window showing at the same time. If I minimize the main window, the log in the console is stopped, and there won't be anything showing in the main window. The splash screen remains on the screen.

In some other conditions, I don't have the main window showing, only splash screen is displayed. But I can't figure out yet what are these conditions.

@rschnekenbu
Copy link
Contributor Author

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

it only actually loads the frontend when I switch to the browser tab.

Yes, but it does load it, so why wouldn't it in the electron case? On my side, I can't reproduce this on Windows, even if I turn off the splash screen configuration.

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

@rschnekenbu "this video can't be played because the file is corrupt" 🤷

@rschnekenbu
Copy link
Contributor Author

@tsmaeder, I can open the video on chrome (and edge), but not from firefox. On firefox, I get the same corrupted file error 🤷

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

Google reveals it's well known compatibility problems with ffmpeg encoding and Firefox. Why can't we just all get along?

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

@rschnekenbu while I can use chrome for this instance, it would be nice if you fixed your setup so folks are not forced to use Chrome.
Also: If I look at the video, the UI seems to come up alright at the end. What's the problem?

@rschnekenbu
Copy link
Contributor Author

Definitely, I will check for other software options for recording video, convert the video or switch to another format. I found this issue about Kazam mp4 encoding: https://support.mozilla.org/mk/questions/1379414.

For the video, until I restore the window, the app is not loading. The log also does not show any progress. As soon as it is displayed again, the loading process seems active, new events are logged, etc.
This looks like we need to keep an eye on the app to get it starting, if not, it will get lazy. After all, we get a running tool, but it is surprising that it stalls when minimized. I would expect the load process to be independent of the tool being visible or not.

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

O.K. so the title slightly misleading. I'll change it, if you don't mind.

@tsmaeder tsmaeder changed the title Theia app is not loading when minimized at startup Theia app is not loading while minimized at startup Jul 3, 2024
@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 3, 2024

@msujew for the browser case, I think this is normal behavior. As for the electron case, there are two things we'll have to look at:

  1. Make sure we turn off backgroundThrottling when constructing our browser windows
  2. Look at our uses of requestAnimationFrame()': we should only use that to orchestrate actual on-screen behavior. not as substitute for setTimeout()`. See "backgroundThrottling: false" no longer affects requestAnimationFrame() in background applications electron/electron#9567

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 4, 2024

Turning off background throttling definitely seems to help. However, sometimes Theia still stops loading for a couple of seconds when starting up. The suspicion from the log is that this happens while restoring the layout. I'm currently experimenting with turning `request

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 4, 2024

Turns out (aka experiments show) the culprit for the delay seems to be in split-panel.ts#animationFrame(). Trying to understand the case.

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 4, 2024

So...it seems that requestAnimationFrame() is called roughly once per second when the Window is minimized, independent of background throttling. The split panel has an optional animation to make the side panels slide in.
My first approach would be to use the page visilibility API to skip the animation when the page is not visible. Turns out though that the page is considered visible with the background throttling turned off. <sigh>. I'll try out what the animation looks like with setTimeout().

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 4, 2024

The animation looks fine with "setTimout()".

tsmaeder added a commit to tsmaeder/theia that referenced this issue Jul 4, 2024
Fixes eclipse-theia#13798

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
@tsmaeder tsmaeder linked a pull request Jul 4, 2024 that will close this issue
1 task
tsmaeder added a commit to tsmaeder/theia that referenced this issue Jul 10, 2024
Fixes eclipse-theia#13798

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
tsmaeder added a commit to tsmaeder/theia that referenced this issue Jul 12, 2024
Fixes eclipse-theia#13798

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants