Repository navigation
Repository indicator optimizations, round two - #10588
Conversation
|
|
||
| private async withPushPullFetch( | ||
| repository: Repository, | ||
| account: IGitAccount | null, |
There was a problem hiding this comment.
I just stumbled upon the fact that this parameter was unused so I removed it which let me keep a newly introduced call to this method on one line. It's unrelated to this PR but it's small enough that I'm hoping we can just sneak it in.
| account: IGitAccount | null | ||
| ): Promise<void> { | ||
| return this.withPushPullFetch(repository, account, async () => { | ||
| return this.withPushPullFetch(repository, async () => { |
There was a problem hiding this comment.
Removes the unused account parameter. No logical difference
| remotes?: IRemote[] | ||
| ): Promise<void> { | ||
| await this.withPushPullFetch(repository, account, async () => { | ||
| await this.withPushPullFetch(repository, async () => { |
There was a problem hiding this comment.
Removes the unused account parameter. No logical difference
| } else { | ||
| this._aheadBehind = null | ||
| } | ||
| } else { | ||
| this._aheadBehind = null | ||
| } | ||
|
|
||
| this.emitUpdate() |
There was a problem hiding this comment.
We haven't run into any problems with not resetting aheadBehind in fetch before since all fetches are followed by a status call which itself refreshes (and resets) the aheadBehind but now that we're running fetch stand-alone it makes sense for us to be more diligent here.
Co-authored-by: Rafael Oleza <[email protected]>
Description
This is a follow-up to #10119 and a precursor to being able to disable background updates for repository indicators.
Prior to this PR the repository indicator updater would call
AppStore.performFetchwhen fetching repositories.performFetchdoes a fair bit more work than just a fetch, such as a full repository refresh, branch protection updates, and branch fast forwards.desktop/app/src/lib/stores/app-store.ts
Lines 4179 to 4192 in 5f2038c
Since all we need for the repository indicators is an ahead/behind status for the current branch (which we'll get from both status, and from running fetch) we can take a shortcut here. We're never run repository indicator refreshes on the currently selected repository and we'll run a full repository refresh when a repository is selected so we're not missing anything.
The second change here is about updating the repository indicator for a repository as soon as we get the results back from
statusinstead of waiting for the fetch. That's just a nice little ux improvement.