Repository navigation
fix: reduce chrome API calls to prevent slowness with DLP extensions - #7
Merged
Merged
Conversation
Changed setActionIcon() from sequential await in a for loop to Promise.all() with parallel execution. Previously, each chrome.action.setIcon() call blocked until completion before the next started - with N tabs, this took N * (single call time). Now all icon updates run in parallel. Root cause: Sequential await in for loop blocked service worker Debug session: .planning/debug/resolved/extension-slowness.md
When DLP extensions like Incydr monitor chrome.* API calls, each call adds latency. The previous setActionIcon() queried all tabs and updated all icons on every DOMContentLoaded event - O(N) API calls for O(1) change. This fix: - Adds setTabIcon() for single-tab updates (O(1) API calls) - Renames setActionIcon() to setAllTabIcons() for mode changes only - Changes onDOMContentLoaded to update only the current tab's icon With 5 Zendesk tabs and 50ms DLP latency per call: - Before: ~300ms per navigation (6 calls) - After: ~50ms per navigation (1 call) Root cause: O(N) chrome.* API calls per event amplified by DLP monitoring Debug session: .planning/debug/resolved/extension-slowness-incydr.md
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.
Summary
setActionIcon()for mode changessetTabIcon()for single-tab updates on navigation eventsProblem
DLP/security extensions add latency to each
chrome.*API call. Previously, every tab navigation triggered N+1 API calls (1 query + N icon updates), causing compounding delays.Solution
Promise.all()when updating all tabs is needed (mode changes)Test plan