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
use openExternal async #8220
use openExternal async #8220
Conversation
This commit uses the new version of openExternal which became async in Electron. Previously we were accidentally discarding the result of openExternal; now we pay attention to it again.
Thanks @vilmibm! From #8156:
So am I understanding correctly that we use it elsewhere, but it's only in this one instance you found that we actually need to make the change? |
We use it in many places; however, in most places we just call it and discard the result. There is only one code path that checks the result, and it didn't need changing; I had to change our lower level wrapper around Electron's |
@vilmibm thank you! 🎉 so from what you saw we should be safe with async behavior in places we probably assumed were sync in the past? |
@outofambit yup! in most places we just called it as [1] desktop/app/src/ui/lib/open-file.ts Line 8 in f37e6bf
|
@vilmibm awesome! pretty sure that was the case, but just wanted to be sure! ✨ |
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.
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.
This looks good 👍
As a newcomer to the codebase, I found it slightly confusing that we have calls to a shell.openExternal()
method in at least 2 places where the shell
reference was to a very different object (Electron vs. IAppShell). However, this isn't something that this PR has introduced nor needs concern itself about.
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.
Thanks for fixing this @vilmibm! This looks ship-ready to me 👍
I do have one non-blocking comment, which can be addressed in a separate PR if we decide it's worth addressing.
So am I understanding correctly that we use it elsewhere, but it's only in this one instance you found that we actually need to make the change?
We use it in many places; however, in most places we just call it and discard the result. There is only one code path that checks the result, and it didn't need changing
Absolutely true 💯. There is also an error handling aspect worth considering. In the other places that we use shell.openExternal
(here and here), if the operation fails then we won't find out about it since the promise will get rejected asynchronously.
From the user's perspective, silent failures here aren't the worst thing in the world because if the operation fails it'll already be pretty apparent by the fact that the webpage didn't open and it seems that there's no subsequent logic relying on successful execution. However, it could certainly save us developers some debugging if we catch and log the errors when they occur.
@kuychaco seems worth a follow-up issue so we can collect UX feedback if needed. would you like to open one or should I? |
@vilmibm @kuychaco If we don't feel like it's a thing we should do immediately, I'd prefer not to open an issue about it unless it surfaces in the wild. Does that seem reasonable? If you think it's worth adding logging for that type of case before merging this PR, I'm totally fine with that. Just for something that stays open and isn't super likely to get prioritized, I'd rather see it surface through a user-reported problem instead of trying to over-optimize ahead of time. |
@billygriffin I'm comfortable merging as is. |
@billygriffin I'm totally cool to merge as is and get this fix in. I would like to see us fix up the other places we use Electron's |
Overview
Fixes #8156
Description
This PR corrects our use of Electron's
shell.openExternal
since it changed to become async by default. There is only one invocation ofopenExternal
where we check the result and potentially show an error; this code path should function once more as of this PR.Release notes
Notes: no-notes