← 输入框|github.com|刷新
Skip to content

Don't show a refresh error when the PR description tab closes during a refresh - #9145

Draft
Alex Ross (alexr00) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-pr-toast-error
Draft

Alex Ross (alexr00) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-pr-toast-error

Conversation

Copilot AI commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Merging from the PR description tab can show Error refreshing pull request description: Webview is disposed. This happens when the merge closes the tab: with deleteBranchAfterMerge and a postDone default-branch checkout, the checkout closes the tab.

The merge fires a state change, and that starts refreshPanel(). While it waits for resolveModel(...), the checkout closes the tab and the panel is disposed. When the refresh resumes, updateItemNow reads this._panel.visible. VS Code's WebviewPanel getters throw Webview is disposed after dispose, and refreshPanel's catch shows that error as a toast.

Changes (PullRequestOverviewPanel)

  • refreshPanel()
    • Returns early if the panel is already disposed. Previously _panel.visible itself threw here, so the call rejected.
    • Re-checks isDisposed after resolveModel and returns quietly.
    • If it fails after the panel is gone, it logs at debug level instead of showing the toast.
  • processPendingUpdates()
    • Stops applying queued updates once the panel is disposed.
    • Before, an update queued before the close (for example from createOrShow) would run updateItemNow, hit the same throw, and make the caller's promise fail.
const pullRequest = await this.resolveModel(this._identity);
// The panel can be closed while the pull request is resolved, such as when merging it checks out the default branch.
if (this.isDisposed) {
	return;
}

Tests

New refreshing a closed panel block in pullRequestOverview.test.ts:

  • A merge-triggered refresh where the tab closes before the pull request reloads: no error toast.
  • refreshPanel() called after the tab is closed: no lookup and no error.
  • An update queued before the close: it is dropped, and createOrShow doesn't fail.

To support these, the createPanel fixture now also returns webviewPanel and the default-branch stub.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error toast when merging PR from description tab Don't show a refresh error when the PR description tab closes during a refresh Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants