-
Notifications
You must be signed in to change notification settings - Fork 333
避免 menuCommand 更新在 Tab 移除后触发 #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "\u907F\u514D-menuCommand-\u66F4\u65B0\u5728-Tab-\u79FB\u9664\u540E\u89E6\u53D1-1"
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,7 +179,6 @@ export class PopupService { | |
|
|
||
| // 防止并发导致频繁更新菜单,将注册菜单的请求集中在一个队列中处理 | ||
| updateMenuCommands = new Map<number, ((TScriptMenuRegister | TScriptMenuUnregister) & { registerType: number })[]>(); | ||
| isUpdateMenuDirty = false; | ||
|
|
||
| // 此函数必须是同步执行的,避免updateMenuCommands并发问题 | ||
| updateMenuCommand(tabId: number, data: ScriptMenu[]): string[] { | ||
|
|
@@ -579,6 +578,12 @@ export class PopupService { | |
| } | ||
| runCountMap.delete(tabId); | ||
| scriptCountMap.delete(tabId); | ||
| const list = this.updateMenuCommands.get(tabId); | ||
| if (list) { | ||
| // 避免 menuCommand 更新在 Tab 移除后触发 | ||
| list.length = 0; | ||
| this.updateMenuCommands.delete(tabId); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我理解 this.updateMenuCommand 在 updateMenuCommand 最后面肯定会删除的,且updateMenuCommand是一个同步函数,这实际是一个无效操作
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 呀。原来现在是 ScriptMenu 没删 ( |
||
| // 清理数据tab关闭需要释放的数据 | ||
| this.txUpdateScriptMenu(tabId, async (scripts) => { | ||
| for (const { uuid } of scripts) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.