Ver código fonte

Removes Graph debounce for known repo changes

Reduces Graph debounce for other changes to 250ms
Updates selected row when HEAD changes
Refs: #2298
main
Eric Amodio 2 anos atrás
pai
commit
a57fb65a94
2 arquivos alterados com 31 adições e 21 exclusões
  1. +23
    -19
      src/git/models/repository.ts
  2. +8
    -2
      src/plus/webviews/graph/graphWebview.ts

+ 23
- 19
src/git/models/repository.ts Ver arquivo

@ -45,30 +45,30 @@ const millisecondsPerHour = 60 * 60 * 1000;
const millisecondsPerDay = 24 * 60 * 60 * 1000;
export const enum RepositoryChange {
// FileSystem = 'filesystem',
Unknown = 'unknown',
// No file watching required
Closed = 'closed',
Ignores = 'ignores',
Starred = 'starred',
Unknown = -1,
// File watching required
CherryPick = 'cherrypick',
Config = 'config',
Heads = 'heads',
Index = 'index',
Merge = 'merge',
Rebase = 'rebase',
Remotes = 'remotes',
RemoteProviders = 'providers',
Stash = 'stash',
Index = 0,
Head = 1,
Heads = 2,
Tags = 3,
Stash = 4,
Remotes = 5,
Worktrees = 6,
Config = 7,
/*
* Union of Cherry, Merge, and Rebase
*/
Status = 'status',
Tags = 'tags',
Worktrees = 'worktrees',
Status = 8,
CherryPick = 9,
Merge = 10,
Rebase = 11,
// No file watching required
Closed = 100,
Ignores = 101,
RemoteProviders = 102,
Starred = 103,
}
export const enum RepositoryChangeComparisonMode {
@ -334,6 +334,10 @@ export class Repository implements Disposable {
return;
case 'HEAD':
this.resetCaches('branches');
this.fireChange(RepositoryChange.Head, RepositoryChange.Heads);
return;
case 'ORIG_HEAD':
this.resetCaches('branches');
this.fireChange(RepositoryChange.Heads);

+ 8
- 2
src/plus/webviews/graph/graphWebview.ts Ver arquivo

@ -496,6 +496,7 @@ export class GraphWebview extends WebviewBase {
if (
!e.changed(
RepositoryChange.Config,
RepositoryChange.Head,
RepositoryChange.Heads,
// RepositoryChange.Index,
RepositoryChange.Remotes,
@ -511,7 +512,12 @@ export class GraphWebview extends WebviewBase {
return;
}
this.updateState();
if (e.changed(RepositoryChange.Head, RepositoryChangeComparisonMode.Any)) {
this.setSelectedRows(undefined);
}
// Unless we don't know what changed, update the state immediately
this.updateState(!e.changed(RepositoryChange.Unknown, RepositoryChangeComparisonMode.Exclusive));
}
@debug({ args: false })
@ -894,7 +900,7 @@ export class GraphWebview extends WebviewBase {
}
if (this._notifyDidChangeStateDebounced == null) {
this._notifyDidChangeStateDebounced = debounce(this.notifyDidChangeState.bind(this), 500);
this._notifyDidChangeStateDebounced = debounce(this.notifyDidChangeState.bind(this), 250);
}
void this._notifyDidChangeStateDebounced();

Carregando…
Cancelar
Salvar