File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import type { CommentEvent, CommentSpot } from '@/lib/enhancer'
22import { type DraftStats , statsFor } from '@/lib/enhancers/draft-stats'
33import { logger } from '@/lib/logger'
44import type { GetTableRowsResponse , ToBackgroundMessage } from '@/lib/messages'
5-
65import {
76 CLOSE_MESSAGE_PORT ,
87 isContentToBackgroundMessage ,
@@ -115,4 +114,16 @@ export default defineBackground(() => {
115114 return handlePopupMessage ( message , sender , sendResponse )
116115 }
117116 } )
117+
118+ browser . tabs . onRemoved . addListener ( ( tabId : number ) => {
119+ logger . debug ( 'tab removed' , { tabId } )
120+
121+ // Clean up openSpots entries for the closed tab
122+ for ( const [ key , value ] of openSpots ) {
123+ if ( tabId === value . tab . tabId ) {
124+ openSpots . delete ( key )
125+ logger . debug ( 'closed tab which contained spot' , value . spot . unique_key )
126+ }
127+ }
128+ } )
118129} )
You can’t perform that action at this time.
0 commit comments