Skip to content

The design language that makes your AI harness better at design.

JavaScript

Fix: make Chrome extension toolbar badge count anti-patterns (#264)

Abdul Wahab1f4021b16c98
diff --git a/extension/background/service-worker.js b/extension/background/service-worker.js
index 9843e6f1a..61612faa4 100644
--- a/extension/background/service-worker.js
+++ b/extension/background/service-worker.js
@@ -20,7 +20,9 @@ function getState(tabId) {
function updateBadge(tabId) {
const state = tabState.get(tabId);
- const count = state?.findings?.length || 0;
+ // Count total anti-pattern findings (an element may carry several), matching
+ // the popup and DevTools panel rather than the flagged-element count.
+ const count = state?.findings?.reduce((sum, f) => sum + (f.findings?.length || 0), 0) || 0;
const text = count > 0 ? String(count) : '';
chrome.action.setBadgeText({ text, tabId }).catch(() => {});
chrome.action.setBadgeBackgroundColor({ color: '#d6336c', tabId }).catch(() => {});