Browse Source

Fixes empty graph on initial load (for fast repos)

Doesn't yet fix the spinners sticking issue
main
Eric Amodio 2 years ago
parent
commit
2df8ab4a35
1 changed files with 22 additions and 10 deletions
  1. +22
    -10
      src/plus/webviews/graph/graphWebview.ts

+ 22
- 10
src/plus/webviews/graph/graphWebview.ts View File

@ -86,6 +86,7 @@ export class GraphWebview extends WebviewBase {
private _etagSubscription?: number;
private _etagRepository?: number;
private _graph?: GitGraph;
private _pendingNotifyCommits: boolean = false;
private _selectedSha?: string;
private _selectedRows: { [sha: string]: true } = {};
private _repositoryEventsDisposable: Disposable | undefined;
@ -177,6 +178,12 @@ export class GraphWebview extends WebviewBase {
return [window.onDidChangeActiveColorTheme(this.onThemeChanged, this)];
}
protected override onReady(): void {
if (this._pendingNotifyCommits) {
void this.notifyDidChangeCommits();
}
}
protected override onMessageReceived(e: IpcMessage) {
switch (e.method) {
case DismissBannerCommandType.method:
@ -473,17 +480,22 @@ export class GraphWebview extends WebviewBase {
@debug()
private async notifyDidChangeCommits() {
if (!this.isReady || !this.visible) return false;
let success = false;
if (this.isReady && this.visible) {
const data = this._graph!;
success = await this.notify(DidChangeCommitsNotificationType, {
rows: data.rows,
avatars: Object.fromEntries(data.avatars),
paging: {
startingCursor: data.paging?.startingCursor,
more: data.paging?.more ?? false,
},
});
}
const data = this._graph!;
return this.notify(DidChangeCommitsNotificationType, {
rows: data.rows,
avatars: Object.fromEntries(data.avatars),
paging: {
startingCursor: data.paging?.startingCursor,
more: data.paging?.more ?? false,
},
});
this._pendingNotifyCommits = !success;
return success;
}
private getConfig(): GraphCompositeConfig {

Loading…
Cancel
Save