bswinnerton / launchbar-github

A LaunchBar action for GitHub
http://launchbar-github.com
MIT License
70 stars 7 forks source link

Command + Enter doesn't work until after repositories have been fetched #87

Closed bswinnerton closed 6 years ago

bswinnerton commented 6 years ago

As reported in https://github.com/bswinnerton/launchbar-github/issues/8#issuecomment-340189604:

@bswinnerton: When I enter a owner/repo name (e.g., apple/swift) and hit command+enter, the LaunchBar window disappears, but it doesn't open the repo:

demo

Is there any trick to getting this to work correctly? If there's additional information I can provide, please let me know.

bswinnerton commented 6 years ago

Pulling out my earlier comment from #8:

Is there any trick to getting this to work correctly?

@jasonrudolph, I suspect that you're hitting + Enter before launchbar-github has a chance to fetch all of the repositories that the Apple organization has access to via an API call to GitHub.

Here's a screen capture of an up-to-date version of launchbar-github that has already cached the result of Apple's repositories:

swift-command-enter

A terrible workaround is to wait for the repositories appear before hitting + Enter. But I've opened https://github.com/bswinnerton/launchbar-github/issues/87 to explore a better way of accomplishing this.

I suspect the offending line is right here:

https://github.com/bswinnerton/launchbar-github/blob/de2381116e16b9612cb96a3e10c4ee7ea0975ee8/Contents/Scripts/default.js#L160

This calls out to Account#repositories, which makes an API call to GitHub here:

https://github.com/bswinnerton/launchbar-github/blob/de2381116e16b9612cb96a3e10c4ee7ea0975ee8/Contents/Scripts/account.js#L30-L48

Before we check to see if the command key has been selected here:

https://github.com/bswinnerton/launchbar-github/blob/de2381116e16b9612cb96a3e10c4ee7ea0975ee8/Contents/Scripts/default.js#L180