File tree Expand file tree Collapse file tree
src/app/service/service_worker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,6 @@ export class PopupService {
179179
180180 // 防止并发导致频繁更新菜单,将注册菜单的请求集中在一个队列中处理
181181 updateMenuCommands = new Map < number , ( ( TScriptMenuRegister | TScriptMenuUnregister ) & { registerType : number } ) [ ] > ( ) ;
182- isUpdateMenuDirty = false ;
183182
184183 // 此函数必须是同步执行的,避免updateMenuCommands并发问题
185184 updateMenuCommand ( tabId : number , data : ScriptMenu [ ] ) : string [ ] {
@@ -579,6 +578,12 @@ export class PopupService {
579578 }
580579 runCountMap . delete ( tabId ) ;
581580 scriptCountMap . delete ( tabId ) ;
581+ const list = this . updateMenuCommands . get ( tabId ) ;
582+ if ( list ) {
583+ // 避免 menuCommand 更新在 Tab 移除后触发
584+ list . length = 0 ;
585+ this . updateMenuCommands . delete ( tabId ) ;
586+ }
582587 // 清理数据tab关闭需要释放的数据
583588 this . txUpdateScriptMenu ( tabId , async ( scripts ) => {
584589 for ( const { uuid } of scripts ) {
You can’t perform that action at this time.
0 commit comments