Skip to content

Commit

Permalink
fix: hotfix for reloading tabs on state change
Browse files Browse the repository at this point in the history
close #10
  • Loading branch information
nobkd committed Oct 3, 2023
1 parent fae1c42 commit 32681cd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/bg/action.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { browserAction, webNavigation, type Tabs, tabs } from 'webextension-polyfill';
import { browserAction, /*webNavigation,*/ type Tabs, tabs } from 'webextension-polyfill';
import { getHostname, invertHostState } from './utils/storage';
import { matcher as mapsUrlMatcher, runtimeMapUrl } from './bg';
//import { matcher as mapsUrlMatcher, runtimeMapUrl } from './bg';

const replacedUrlMatcher = new RegExp(`^${runtimeMapUrl}\?`);
//const replacedUrlMatcher = new RegExp(`^${runtimeMapUrl}\?`);

/**
* Async function to react to clicks on the browser action icon.
Expand All @@ -18,15 +18,16 @@ async function actionClick(tab: Tabs.Tab): Promise<void> {
let hostname = getHostname(tab.url);
await invertHostState(hostname);

/*
let frames = (await webNavigation.getAllFrames({ tabId: tab.id })) ?? [];
if (
frames.some((frame) => {
frame.url.match(replacedUrlMatcher) || frame.url.match(mapsUrlMatcher);
})
) {
tabs.reload(tab.id, { bypassCache: true });
}
)
*/
tabs.reload(tab.id, { bypassCache: true });
}

browserAction.onClicked.addListener(actionClick);

0 comments on commit 32681cd

Please sign in to comment.