-
Notifications
You must be signed in to change notification settings - Fork 245
fix(compass): disable spellcheck before creating window when no network traffic COMPASS-8166 #6853
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,20 @@ class CompassApplication { | |
| // Accessing isEncryptionAvailable is not allowed when app is not ready on Windows | ||
| // https://github.com/electron/electron/issues/33640 | ||
| await app.whenReady(); | ||
|
|
||
| const { networkTraffic } = this.preferences.getPreferences(); | ||
|
|
||
| if (!networkTraffic) { | ||
| // Electron fetches spellcheck dictionaries from a CDN | ||
| // on all OSs expect mac (it provides a built-in spell check). | ||
| // Passing a non-resolving URL prevents it from fetching | ||
| // as there aren't any options to disable it provided. | ||
| // https://github.com/electron/electron/issues/22995 | ||
| session.defaultSession.setSpellCheckerDictionaryDownloadURL( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wow. well caught. |
||
| 'http://127.0.0.1:0/' | ||
| ); | ||
| } | ||
|
|
||
| log.info( | ||
| mongoLogId(1_001_000_307), | ||
| 'Application', | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I guess this is something we can't control at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found one yet.
It seems like electron command line switches redirect it with the host rules / host resolver rules.
https://www.electronjs.org/docs/latest/api/command-line-switches#--host-rulesrules
I'll spend a bit of time looking into that and circle back before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early on in our application code to override the host resolution it looks like we can:
That will cause all of the network requests to start failing if it doesn't succeed though as I think more of the stack relies on this request for knowing where to send requests. I'm thinking as a fix we could maybe provide users a way to specify this themselves.
I'm going to merge this pr for the other fix and create a follow up ticket and link a todo in the code. I think it still needs a bit of investigation and thought