Repository navigation
avoid invoking status when updating indicator for current repository - #7475
Merged
Merged
Conversation
This was referenced May 7, 2019
shiftkey
force-pushed
the
shiftkey/no-duplicate-get-status-needed
branch
from
May 9, 2019 17:50
77b78ed to
fb60f86
Compare
iAmWillShepherd
previously approved these changes
May 9, 2019
iAmWillShepherd
left a comment
Contributor
There was a problem hiding this comment.
My comment doesn't need to hold up this PR since what's here works just fine.
outofambit
suggested changes
May 9, 2019
outofambit
left a comment
Contributor
There was a problem hiding this comment.
a couple tweaks, please, before we merge this. overall this is a nice refactor!
shiftkey
force-pushed
the
shiftkey/no-duplicate-get-status-needed
branch
from
May 10, 2019 11:17
21454ed to
b74fdcd
Compare
shiftkey
requested review from
iAmWillShepherd and
outofambit
and removed request for
outofambit
May 10, 2019 11:18
outofambit
approved these changes
May 10, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Related to #7464
Description
Whenever
AppStore._refreshRepositoryruns (updating the current repository), it also runsAppStore.refreshIndicatorsForRepositoriesat the end.Internally this does two expensive things:
AppStore._loadStatus()to see whether there are working directory changesAppStore.fetch()to background fetch and detect the ahead/behind of the current branchThis feels rather wasteful to do for the active repository, and we already have a
AppStore._loadStatus()result from earlier inAppStore._refreshRepositorythat has sufficient information for this UI (are there working changes?).Given this function opts out of fetching while refreshing, and we have a relatively recent
getStatusresult, this PR introduces a more explicitAppStore.updateSidebarIndicatorthat is now used inrefreshRepository, and leaves the existing behaviour inAppStore.refreshAllSidebarIndicatorsto be run when the background refresh happens.This PR eliminates three Git operations that run on every refresh (a
git statusand twogit diff).On a
desktop/desktoprepository with a clean working directory:Before
After
On a
nodejs/noderepository with 33k files removed in the working directory:Before
After
Release notes
Notes: no-notes