Skip to content

Merging from the PR description tab shows "Error refreshing pull request description: Webview is disposed" #9143

Open

Description

@Pawls

Bug. After merging a PR from the PR description tab, VS Code shows the error toast Error refreshing pull request description: Webview is disposed. The merge itself, the branch deletion and the checkout all succeed; the tab was going to close anyway, so the toast is noise.

Steps

  1. Set "githubPullRequests.deleteBranchAfterMerge": true and "githubPullRequests.postDone": "checkoutDefaultBranchAndPull".
  2. Check out a PR branch and open its description tab.
  3. Merge the PR from the tab.

Expected: the tab closes with no notification.
Actual: the tab closes and the error toast appears every time.

Cause (read from the code, not stepped through). the PR overview panel's refreshPanel() (minified in dist/extension.js, v0.174.0) checks this._panel.visible and this._refreshing once, then awaits resolveModel(...) and updateItem(...); its catch shows the toast:

async refreshPanel() {
  if (!(!this._panel.visible || this._refreshing)) {
    this._refreshing = true;
    try {
      const e = await this.resolveModel(this._identity);
      if (!e) throw new Error(`Failed to resolve Pull Request #...`);
      await this.updateItem(e);
    } catch (e) {
      window.showErrorMessage(`Error refreshing pull request description: ${...}`);
    } finally { this._refreshing = false; }
  }
}

After a merge the extension disposes the panel (PR done, branch deleted, default branch checked out) while a refresh that started earlier is still awaiting the model. When it resumes, updateItem posts to a disposed webview and throws.

Suggested fix. Track disposal (an onDidDispose flag, or re-check the panel after each await) and return quietly instead of calling showErrorMessage when the panel is gone. Related closed reports with the same message but other triggers: #2444, #4847, #5037.

Environment: extension 0.174.0, VS Code 1.144.0, Windows 11.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions