Repository navigation
fix(context-menus): avoid duplicate id errors on service worker restart - #567
Merged
Merged
Conversation
Context menus persist across MV3 service worker restarts, but initialize() recreated them at every startup, logging 'Cannot create item with duplicate id' for each of the 6 menus. Clear them with removeAll() first.
📦 Extension Build Ready!Version: 📥 Download Extension (tabee.zip)Installation
Status
🤖 Auto-generated by GitHub Actions |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Merged
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
After the service worker restarts,
chrome://extensions/shows an Errors button with 6 messages:(same for
merge-windows,send-to-hive,tab-hive-reject-parent,tab-hive-reject-domain,tab-hive-reject-url).Manifest V3 service workers are stopped and restarted often, and
contextMenuService.initialize()runs at every startup. Context menus persist across restarts, so everycreateafter the first startup fails. The menus keep working; it's only noise, but users see the Errors button. This predates the recent upgrades (same code in 1.1.6).Found during the manual test campaign on
773bb42.Fix
initialize()now callschrome.contextMenus.removeAll()and creates the menus in its callback. The signature stays synchronous, so the call inbackground.tsis unchanged.Tests
removeAllis called before anycreate.vue-tscand build OK.