Skip to content

Ensure editor from local storage is actually installed - #8388

Merged
outofambit merged 1 commit into
ku-always-resolve-upon-setting-external-editorfrom
ku-ensure-local-storage-editor-is-installed
Oct 16, 2019
Merged

outofambit merged 1 commit into
ku-always-resolve-upon-setting-external-editorfrom
ku-ensure-local-storage-editor-is-installed

Conversation

@kuychaco

@kuychaco kuychaco commented Oct 2, 2019 •

Copy link
Copy Markdown
Contributor

Overview

Closes #8386

Description

This PR verifies that the editor stored in local storage is actually installed (it might have been uninstalled recently by the user, as in #8322). If it is not, we update the stored selected editor based to be one that is installed. Prior to this change, if the user uninstalled the editor that was stored in local storage, then we'd throw an error and would fail to resolve the current editor at startup. For users in an onboarding tutorial, this could mean that the first "Install a text editor" step erroneously shows that no editor is installed.

Release notes

Notes: no-notes

/cc @niik @outofambit @billygriffin

…t is

Prior to this change, if the user uninstalled the editor they'd selected then we'd throw an error and would fail to resolve the current editor at startup
@kuychaco
kuychaco changed the base branch from development to ku-always-resolve-upon-setting-external-editor October 2, 2019 02:03
@kuychaco kuychaco changed the title Ku ensure local storage editor is installed Ensure editor from local storage is actually installed Oct 2, 2019
@niik

niik commented Oct 2, 2019

Copy link
Copy Markdown
Member

I was under the impression that we differentiated between selected and resolved editor was so that we'd keep track of what the user has indicated that they want to use and what's actually available.

If I'm reading this PR correctly we're now going from using any available editor while the preferred one isn't available to making whatever available editor we find the preferred editor just as if the user had explicitly picked the editor themselves.

To be clear, I'm not against making that change but I feel like it does beg the question of why we'd need the resolvedEditor at all if we do? Could we not rely entirely on the selectedEditor now?

@niik niik mentioned this pull request Oct 2, 2019
@billygriffin

Copy link
Copy Markdown
Contributor

If I'm reading this PR correctly we're now going from using any available editor while the preferred one isn't available to making whatever available editor we find the preferred editor just as if the user had explicitly picked the editor themselves.

I'm not 100% sure I understand this. If this isn't going into the release, could we discuss the UX implications and scenarios before we merge this?

@niik

niik commented Oct 2, 2019

Copy link
Copy Markdown
Member

I'm not 100% sure I understand this.

Wow yeah, reading that again I half-way don't understand it myself. What I was trying to say was that it felt like this PR was removing the distinction between selectedEditor and resolvedEditor and I was wondering if there was any need to keep the resolvedEditor around at all.

Historically we used to let the user pick an editor (selectedExternalEditor) and if, when they wanted to use it, it wasn't available anymore we'd throw an error asking them to pick another editor or install Atom. Then #6109 came along and said that if we can't find the editor that the user has selected we should just pick whatever editor we can find and thus resolvedExternalEditor was born and (as we've recently found out was full of problems).

So the selectedExternalEditor would always stay the same and be a direct representation of what the user had selected whereas the resolvedExternalEditor would dynamically change depending on what's available.

With this PR we're making it such that if the selectedExternalEditor isn't installed on the user's machine we'll figure out if there's any other editor we can use and update selectedExternalEditor to that value meaning that selectedExternalEditor now becomes dynamic as well.

If this isn't going into the release, could we discuss the UX implications and scenarios before we merge this?

👍 I think regardless of which approach we end up taking we should look at consolidating the user-facing uses of selected and resolved because right now we're using a mix of them throughout the application and they're not necessarily in sync.

@kuychaco

kuychaco commented Oct 3, 2019 •

Copy link
Copy Markdown
Contributor Author

Thanks for all of the helpful historical context @niik. I can now more clearly see how this code came to be.

I think regardless of which approach we end up taking we should look at consolidating the user-facing uses of selected and resolved because right now we're using a mix of them throughout the application and they're not necessarily in sync

100%. I'd spoken to @outofambit about wanting to do this when we have the bandwidth for it (see #8322 (comment) for extra context). Which is maybe now? We both figured that it was worth refactoring and simplifying the selected/resolved editor code because currently it seems to be a breeding ground for bugs, and it's not the easiest for us developers to reason about.

And in the meantime, I was thinking this could be a stopgap for addressing #8386. Do you think that sounds reasonable @niik?

@kuychaco kuychaco added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 4, 2019
@tierninho
tierninho self-requested a review October 8, 2019 19:31

@tierninho tierninho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the repro steps here:

Install Atom and another valid editor (like VS Code)
Set Atom as your editor in Preferences
Uninstall Atom (on Mac, you can simply move to trash)
Reload GitHub Desktop

this fix seems to be working ✅

@outofambit outofambit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one little thing, but otherwise great!

Comment thread app/src/lib/stores/app-store.ts Resolved
@kuychaco

Copy link
Copy Markdown
Contributor Author

could we discuss the UX implications and scenarios before we merge this?

FYI had a discussion with @billygriffin to discuss this and got a 👍

@outofambit outofambit self-assigned this Oct 16, 2019
@outofambit
outofambit merged commit daa38d1 into ku-always-resolve-upon-setting-external-editor Oct 16, 2019
@outofambit
outofambit deleted the ku-ensure-local-storage-editor-is-installed branch October 16, 2019 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants