Fix webview view badge not clearing when set to undefined - #331019
Open
Hadley Wickham (hadley) wants to merge 1 commit into
Open
Fix webview view badge not clearing when set to undefined#331019Hadley Wickham (hadley) wants to merge 1 commit into
Hadley Wickham (hadley) wants to merge 1 commit into
Conversation
WebviewViewPane.updateBadge registers the view activity when a badge is assigned but never disposes it when the badge is set back to undefined, so the badge stays visible on the view container after the extension clears it. The tree view badge setter already handles this with an else branch that clears the activity; add the same here.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes stale webview view badges by clearing the registered activity when a badge is removed.
Changes:
- Clears webview view activity when its badge becomes
undefined. - Aligns badge handling with tree views.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WebviewViewPane.updateBadgeregisters the view activity (the numeric badge on the view container) when a badge is assigned, but never disposes it when the badge is set back toundefined. The badge therefore stays visible on the activity bar after the extension has cleared it.The tree view badge setter in
src/vs/workbench/browser/parts/views/treeView.tshandles this correctly with anelse { this._activity.clear(); }branch; the webview view pane is missing the equivalent.Repro: from an extension, set
webviewView.badge = { value: 1, tooltip: '...' }on a registered webview view, then setwebviewView.badge = undefined. The badge remains visible.Fix
Add the missing
elsebranch to clear the registered activity when the badge becomesundefined, mirroring the tree view implementation.