Skip to content

Commit e5dda36

Browse files
committed
fix: cleanup cache without detect url changing
1 parent 056d6cd commit e5dda36

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/background.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { UpdatePayload } from './typings/webpage-message';
66

77
let enabledTab = new Set<number>();
88
let tabData = new Map<number, Record<string, UpdatePayload['data']>>();
9-
let pervTabUrl = new Map<number, string>();
109

1110
const cleanupCache = (tabId: number) => {
1211
if (enabledTab.has(tabId)) {
@@ -15,16 +14,10 @@ const cleanupCache = (tabId: number) => {
1514
if (tabData.has(tabId)) {
1615
tabData.delete(tabId);
1716
}
18-
if (pervTabUrl.has(tabId)) {
19-
pervTabUrl.delete(tabId);
20-
}
2117
};
2218

23-
chrome.tabs.onUpdated.addListener((tabId, _, tab) => {
24-
if (pervTabUrl.get(tabId)! !== tab.url) {
25-
cleanupCache(tabId);
26-
}
27-
pervTabUrl.set(tabId, tab.url!);
19+
chrome.tabs.onUpdated.addListener((tabId) => {
20+
cleanupCache(tabId);
2821
addExtensionMessageListener((message) => {
2922
switch (message.type) {
3023
case 'WELCOME': {

0 commit comments

Comments
 (0)