Skip to content

Commit 57a5507

Browse files
authored
Git - Tweak optimistic update (#165815)
Tweak optimistic update
1 parent 8f7aec2 commit 57a5507

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

extensions/git/src/repository.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,11 @@ export class Repository implements Disposable {
20542054

20552055
private async _updateModelState(optimisticResourcesGroups?: GitResourceGroups, cancellationToken?: CancellationToken): Promise<void> {
20562056
try {
2057+
// Optimistically update resource groups
2058+
if (optimisticResourcesGroups) {
2059+
this._updateResourceGroupsState(optimisticResourcesGroups);
2060+
}
2061+
20572062
const config = workspace.getConfiguration('git');
20582063
let sort = config.get<'alphabetically' | 'committerdate'>('branchSortOrder') || 'alphabetically';
20592064
if (sort !== 'alphabetically' && sort !== 'committerdate') {
@@ -2079,13 +2084,10 @@ export class Repository implements Disposable {
20792084

20802085
this._sourceControl.commitTemplate = commitTemplate;
20812086

2082-
// Optimistically update the resource states
2083-
if (optimisticResourcesGroups) {
2084-
this._updateResourceGroupsState(optimisticResourcesGroups);
2085-
}
2086-
2087-
// Update resource states based on status information
2087+
// Update resource states based on status data
20882088
this._updateResourceGroupsState(await this.getStatus(cancellationToken));
2089+
2090+
this._onDidChangeStatus.fire();
20892091
}
20902092
catch (err) {
20912093
if (err instanceof CancellationError) {
@@ -2105,8 +2107,6 @@ export class Repository implements Disposable {
21052107

21062108
// set count badge
21072109
this.setCountBadge();
2108-
2109-
this._onDidChangeStatus.fire();
21102110
}
21112111

21122112
private async getStatus(cancellationToken?: CancellationToken): Promise<GitResourceGroups> {

0 commit comments

Comments
 (0)