Browse Source

Fixes details getting overwritten when opening

main
Eric Amodio 1 year ago
parent
commit
fb0ca653cd
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 11
- 1
src/webviews/commitDetails/commitDetailsWebview.ts View File

@ -165,6 +165,8 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
void this.notifyDidChangeState(true);
}
private _skipNextRefreshOnVisibilityChange = false;
async onShowing(
_loading: boolean,
options: { column?: ViewColumn; preserveFocus?: boolean },
@ -223,6 +225,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
if (data?.preserveVisibility && !this.host.visible) return false;
this._skipNextRefreshOnVisibilityChange = true;
return true;
}
@ -278,6 +281,11 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
this.updatePendingContext({ visible: visible });
if (!visible) return;
const skipRefresh = this._skipNextRefreshOnVisibilityChange;
if (skipRefresh) {
this._skipNextRefreshOnVisibilityChange = false;
}
// Since this gets called even the first time the webview is shown, avoid sending an update, because the bootstrap has the data
if (this._bootstraping) {
this._bootstraping = false;
@ -286,7 +294,9 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
this.updateState();
} else {
this.onRefresh();
if (!skipRefresh) {
this.onRefresh();
}
this.updateState(true);
}
}

Loading…
Cancel
Save