Skip to content

Commit

Permalink
SCM - fix graph refresh while switching between editor tabs (#230292)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Oct 2, 2024
1 parent 889feaf commit d78a74b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vs/workbench/contrib/scm/browser/scmViewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { binarySearch } from '../../../../base/common/arrays.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
import { derivedObservableWithCache, latestChangedValue, observableFromEventOpts } from '../../../../base/common/observable.js';
import { derivedObservableWithCache, derivedOpts, latestChangedValue, observableFromEventOpts } from '../../../../base/common/observable.js';
import { IEditorService } from '../../../services/editor/common/editorService.js';
import { EditorResourceAccessor } from '../../../common/editor.js';

Expand Down Expand Up @@ -186,7 +186,15 @@ export class SCMViewService implements ISCMViewService {
* The focused repository takes precedence over the active editor repository when the observable
* values are updated in the same transaction (or during the initial read of the observable value).
*/
readonly activeRepository = latestChangedValue(this, [this._activeEditorRepository, this._focusedRepository]);
private readonly _activeRepository = latestChangedValue(this, [this._activeEditorRepository, this._focusedRepository]);

/**
* Derived with a custom equality function
*/
readonly activeRepository = derivedOpts<ISCMRepository | undefined>({
owner: this,
equalsFn: (r1, r2) => r1?.id === r2?.id
}, reader => this._activeRepository.read(reader));

private _repositoriesSortKey: ISCMRepositorySortKey;
private _sortKeyContextKey: IContextKey<ISCMRepositorySortKey>;
Expand Down

5 comments on commit d78a74b

@Nordtom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alk

@Nordtom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All

@Nordtom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@Nordtom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je

@Nordtom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Money for me

Please sign in to comment.