fix: Activate event window creation awaits app ready state - #130
Merged
wojtekn merged 2 commits intoMay 15, 2024
Conversation
Creating a window before the app is "ready" results in an error.
Unlikely to occur, but likely still worth handling as we do not want to start the user off with an error.
dcalhoun
marked this pull request as ready for review
May 14, 2024 17:05
derekblank
approved these changes
May 15, 2024
derekblank
left a comment
Contributor
There was a problem hiding this comment.
I was able to follow the testing steps successfully:
- Observed the error on
trunk, reproduced with the provided diff - Observed the error was not present on this PR branch with the diff still applied
LGTM. Thanks for adding tests as well. 🚀
wojtekn
approved these changes
May 15, 2024
wojtekn
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Thanks for adding tests!
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/Automattic/dotcom-forge/issues/7158.
Proposed Changes
Await the app "ready" state before creating a window within the app "activate"
event handler.
Testing Instructions
Note
The test instructions are a contrived example as the original crash is the result of a race condition between the
readyandactivateevent handler logic. The instructions rely upon intentionally creating a window within thewill-finish-launchingevent handler, which is guaranteed to run before thereadyevent.Contrived error diff
Example window error
trunkbranch.npm start.Pre-merge Checklist