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

fix: wait for theia initalWindow to be set before opening sketch through open-file event #2693

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

giacomocusinato
Copy link
Collaborator

@giacomocusinato giacomocusinato commented Apr 7, 2025

Motivation

Resolves #2688

Change description

Theia internally create an initial empty window on app start to improve UX while first loading the app instance, see eclipse-theia/theia#12897
On MacOS, since open sketch via file association was triggered before initial window reference was set, the open sketch logic would create a new window instance instead of reusing the early created window reference, leaving an unresponsive additional empty window.

Currently there is no ideal way to wait or react to initialWindow value change, so we pool on the value.
Note that this only needed on the first window startup as on other instances, showWindowEarly is not used and initialWindow is null.
The pool sets a generous amount of retries but should bail consistently on the first try as initialWindow is set right after the app is ready. Note that in case the pools times out, we open the sketch on a new window anyway.

@giacomocusinato giacomocusinato added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Apr 7, 2025
@giacomocusinato giacomocusinato marked this pull request as draft April 7, 2025 09:34
@giacomocusinato giacomocusinato force-pushed the fix-macos-empty-window branch from 23582d8 to 0a6ce3e Compare April 7, 2025 16:15
@giacomocusinato giacomocusinato self-assigned this Apr 7, 2025
@giacomocusinato giacomocusinato marked this pull request as ready for review April 7, 2025 16:15
@giacomocusinato giacomocusinato changed the title fix: subscribe to open-file event after initial window is shown fix: wait for theia initalWindow to be set before opening sketch through open-file event Apr 7, 2025
@davegarthsimpson davegarthsimpson merged commit a669a43 into main Apr 7, 2025
44 checks passed
@davegarthsimpson davegarthsimpson deleted the fix-macos-empty-window branch April 7, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra blank window when IDE started via sketch file association
2 participants