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 "Project is empty" issue when using Teletype #343

Merged
merged 2 commits into from Apr 2, 2018

Conversation

Projects
None yet
2 participants
@jasonrudolph
Member

jasonrudolph commented Apr 2, 2018

Description of the Change

If teletype is installed and enabled, the file finder asks the teletype service for a list of remote editors:

const remoteEditors = this.teletypeService ? await this.teletypeService.getRemoteEditors() : []

fuzzy-finder then iterates over the list of remote editors:

const remoteItems = remoteEditors.map((remoteEditor) => {

However, it's possible for getRemoteEditors() to return null. When that happens, the file finder fails to show any local files. Instead, it shows "Project is empty", and we see an error in the console:

screen shot 2018-04-02 at 12 26 58 pm

This pull request teaches the fuzzy-finder to gracefully handle a null return value from getRemoteEditors().

Alternate Designs

We could change Teletype's getRemoteEditors() method to return an empty array instead of returning null. (I intend to open a pull request for that change soon.) However, Teletype is not presently bundled with Atom. If we only fix the issue in Teletype, people might not realize that they need to upgrade Teletype in order to fix this behavior in the fuzzy finder. Since fuzzy-finder is bundled with Atom, we can fix this issue in fuzzy-finder and guarantee that people get this fix when they upgrade Atom.

Verification process

  • Verify file finder shows local files when Teletype is enabled and getRemoteEditors() returns null
  • Verify file finder shows local files and remote files when Teletype is enabled and getRemoteEditors() returns nonempty list of remote editors
  • Verify file finder shows local files Teletype is disabled
  • Verify file finder shows local files Teletype is not installed

Note: Because @annthurium first observed this issue with Teletype 0.10.0, I'll run through the verification process above with Teletype 0.10.0 and the current version (0.11.0).

@jasonrudolph jasonrudolph self-assigned this Apr 2, 2018

@jasonrudolph jasonrudolph requested a review from as-cii Apr 2, 2018

@jasonrudolph jasonrudolph changed the title from [WIP] Fix "Project is empty" issue when using Teletype to Fix "Project is empty" issue when using Teletype Apr 2, 2018

@as-cii

as-cii approved these changes Apr 2, 2018

Looks good! Thanks for fixing this, @jasonrudolph!

@jasonrudolph jasonrudolph merged commit 518dc8f into master Apr 2, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jasonrudolph jasonrudolph deleted the gracefully-handle-null-remote-editor-list branch Apr 2, 2018

jasonrudolph added a commit to atom/teletype that referenced this pull request Apr 5, 2018

jasonrudolph added a commit to atom/teletype that referenced this pull request Apr 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment