Skip to content

Commit da7229b

Browse files
authored
Clean up now that we support multi webview (#8503)
1 parent 7e4e624 commit da7229b

2 files changed

Lines changed: 5 additions & 42 deletions

File tree

src/github/issueOverview.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class IssueOverviewPanel<TItem extends IssueModel = IssueModel> extends W
220220

221221
public async refreshPanel(): Promise<void> {
222222
if (this._panel && this._panel.visible) {
223-
await this.update(this._folderRepositoryManager, this._item);
223+
await this.updateItem(this._item);
224224
}
225225
}
226226

@@ -340,19 +340,14 @@ export class IssueOverviewPanel<TItem extends IssueModel = IssueModel> extends W
340340
*/
341341
public async updateWithIdentity(foldersManager: FolderRepositoryManager, identity: UnresolvedIdentity, issueModel?: TItem, progressLocation?: string): Promise<void> {
342342
this._identity = identity;
343-
344-
if (this._folderRepositoryManager !== foldersManager) {
345-
this._folderRepositoryManager = foldersManager;
346-
this.registerPrListeners();
347-
}
343+
this._folderRepositoryManager = foldersManager;
348344

349345
this._postMessage({
350346
command: 'set-scroll',
351347
scrollPosition: this._scrollPosition,
352348
});
353349

354-
const isNewItem = !this._item || (this._item.number !== identity.number);
355-
if (isNewItem || !this._panel.webview.html) {
350+
if (!this._panel.webview.html) {
356351
this._panel.webview.html = this.getHtmlForWebview();
357352
if (this._item) {
358353
this._postMessage({ command: 'pr.clear' });
@@ -377,15 +372,6 @@ export class IssueOverviewPanel<TItem extends IssueModel = IssueModel> extends W
377372
}
378373
}
379374

380-
public async update(foldersManager: FolderRepositoryManager, issueModel: TItem, progressLocation?: string): Promise<void> {
381-
const identity: UnresolvedIdentity = {
382-
owner: issueModel.remote.owner,
383-
repo: issueModel.remote.repositoryName,
384-
number: issueModel.number
385-
};
386-
return this.updateWithIdentity(foldersManager, identity, issueModel, progressLocation);
387-
}
388-
389375
protected override async _onDidReceiveMessage(message: IRequestMessage<any>) {
390376
const result = await super._onDidReceiveMessage(message);
391377
if (result !== this.MESSAGE_UNHANDLED) {

src/github/pullRequestOverview.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
120120
this._postMessage({ command: 'pr.scrollToPendingReview' });
121121
}
122122

123-
124123
/**
125124
* Get the currently active pull request from the active panel
126125
*/
@@ -297,16 +296,11 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
297296
}
298297

299298
protected override async updateItem(pullRequestModel: PullRequestModel): Promise<void> {
300-
const isSamePullRequest = pullRequestModel.equals(this._item);
301-
if (this._updatingPromise && isSamePullRequest) {
299+
if (this._updatingPromise) {
302300
Logger.error('Already updating pull request webview', PullRequestOverviewPanel.ID);
303301
return;
304-
} else if (this._updatingPromise && !isSamePullRequest) {
305-
this._item = pullRequestModel;
306-
await this._updatingPromise;
307-
} else {
308-
this._item = pullRequestModel;
309302
}
303+
this._item = pullRequestModel;
310304

311305
try {
312306
const updatingPromise = Promise.all([
@@ -365,11 +359,6 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
365359
);
366360
}
367361

368-
if (!this._item.equals(pullRequestModel)) {
369-
// Updated PR is no longer the current one
370-
return;
371-
}
372-
373362
this._item = pullRequest;
374363
this.registerPrListeners();
375364
this._repositoryDefaultBranch = defaultBranch!;
@@ -472,18 +461,6 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
472461
PullRequestOverviewPanel._onVisible.fire(this._item);
473462
}
474463

475-
public override async update(
476-
folderRepositoryManager: FolderRepositoryManager,
477-
pullRequestModel: PullRequestModel,
478-
): Promise<void> {
479-
const identity: UnresolvedIdentity = {
480-
owner: pullRequestModel.remote.owner,
481-
repo: pullRequestModel.remote.repositoryName,
482-
number: pullRequestModel.number
483-
};
484-
return this.updateWithIdentity(folderRepositoryManager, identity, pullRequestModel, 'pr:github');
485-
}
486-
487464
protected override async _onDidReceiveMessage(message: IRequestMessage<any>) {
488465
const result = await super._onDidReceiveMessage(message);
489466
if (result !== this.MESSAGE_UNHANDLED) {

0 commit comments

Comments
 (0)