Skip to content

Commit d78a74b

Browse files
authored
SCM - fix graph refresh while switching between editor tabs (#230292)
1 parent 889feaf commit d78a74b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/vs/workbench/contrib/scm/browser/scmViewService.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { binarySearch } from '../../../../base/common/arrays.js';
1818
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
1919
import { IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
2020
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
21-
import { derivedObservableWithCache, latestChangedValue, observableFromEventOpts } from '../../../../base/common/observable.js';
21+
import { derivedObservableWithCache, derivedOpts, latestChangedValue, observableFromEventOpts } from '../../../../base/common/observable.js';
2222
import { IEditorService } from '../../../services/editor/common/editorService.js';
2323
import { EditorResourceAccessor } from '../../../common/editor.js';
2424

@@ -186,7 +186,15 @@ export class SCMViewService implements ISCMViewService {
186186
* The focused repository takes precedence over the active editor repository when the observable
187187
* values are updated in the same transaction (or during the initial read of the observable value).
188188
*/
189-
readonly activeRepository = latestChangedValue(this, [this._activeEditorRepository, this._focusedRepository]);
189+
private readonly _activeRepository = latestChangedValue(this, [this._activeEditorRepository, this._focusedRepository]);
190+
191+
/**
192+
* Derived with a custom equality function
193+
*/
194+
readonly activeRepository = derivedOpts<ISCMRepository | undefined>({
195+
owner: this,
196+
equalsFn: (r1, r2) => r1?.id === r2?.id
197+
}, reader => this._activeRepository.read(reader));
190198

191199
private _repositoriesSortKey: ISCMRepositorySortKey;
192200
private _sortKeyContextKey: IContextKey<ISCMRepositorySortKey>;

0 commit comments

Comments
 (0)