Skip to content

avoid using getDefaultRemote where possible - #5399

Merged
iAmWillShepherd merged 4 commits into
masterfrom
use-the-cache-for-finding-the-remote
Sep 5, 2018
Merged

iAmWillShepherd merged 4 commits into
masterfrom
use-the-cache-for-finding-the-remote

Conversation

@shiftkey

Copy link
Copy Markdown
Member

Desktop will refresh the default remote inside AppStore.refreshRepository, and I think we can avoid making this call repeatedly when the result is already cached and not likely to change quickly for users.

AppStore.matchGitHubRepository does have a number of callers and will fire more regularly, and AppStore._checkoutPullRequest is only called by the Dispatcher.

this value is updated inside AppStore.refreshRepository and is not likely to change regularly
@shiftkey shiftkey added ready-for-review Pull Requests that are ready to be reviewed by the maintainers infrastructure Issues and pull requests related to scripts and tooling for GitHub Desktop labels Aug 14, 2018
@shiftkey shiftkey added this to the 1.3.4 milestone Aug 14, 2018

@iAmWillShepherd iAmWillShepherd 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.

The only real changes I'm requesting is the pre-fix and explicit check comment, the other is mostly a suggestion.

Comment thread app/src/lib/stores/app-store.ts Outdated

/** This shouldn't be called directly. See `Dispatcher`. */
public async _repositoryWithRefreshedGitHubRepository(
private async _repositoryWithRefreshedGitHubRepository(

This comment was marked as spam.

Comment thread app/src/lib/stores/app-store.ts Outdated
const remote = await getDefaultRemote(repository)
const gitStore = this.getGitStore(repository)
const remote = gitStore.defaultRemote
return remote ? matchGitHubRepository(this.accounts, remote.url) : null

This comment was marked as spam.

if (isRefInThisRepo) {
const defaultRemote = await getDefaultRemote(repository)
const gitStore = this.getGitStore(repository)
const defaultRemote = gitStore.defaultRemote

This comment was marked as spam.

This comment was marked as spam.

@iAmWillShepherd iAmWillShepherd self-assigned this Sep 4, 2018
@shiftkey

shiftkey commented Sep 5, 2018

Copy link
Copy Markdown
Member Author

🍎

@iAmWillShepherd
iAmWillShepherd merged commit 60032ba into master Sep 5, 2018
@iAmWillShepherd
iAmWillShepherd deleted the use-the-cache-for-finding-the-remote branch September 5, 2018 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Issues and pull requests related to scripts and tooling for GitHub Desktop 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.

2 participants