Skip to content

Commit

Permalink
fix custom filter subscribing when options page is open
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Jul 3, 2024
1 parent 8bc95d4 commit 01add4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Extension/src/background/api/ui/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,12 @@ export class PagesApi {
const tab = await TabsApi.findOne({ url: `${PagesApi.settingsUrl}*` });

if (!tab) {
return browser.tabs.create({ url });
const newTab = await browser.tabs.create({ url });
return newTab;
}

return browser.tabs.update(tab.id, { url });
const updatedTab = await browser.tabs.update(tab.id, { url });
return updatedTab;
}

/**
Expand All @@ -363,11 +365,11 @@ export class PagesApi {

const tab = await PagesApi.openTabOnSettingsPage(path);

await TabsApi.focus(tab);

// Reload option page for force modal window rerender
// TODO: track url update in frontend and remove force reloading via webextension API
await TabsApi.reload(tab.id);

await TabsApi.focus(tab);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions Extension/src/common/api/extension/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ export class TabsApi {
}

/**
* Reload tab without cache by specified id.
* Reloads a tab without cache by specified id.
*
* Clearing the cache on reload is necessary for correct application of the rules on pages with service workers.
*
* @param id Tab id.
*/
public static async reload(id: number | undefined): Promise<void> {
return browser.tabs.reload(id, {
await browser.tabs.reload(id, {
bypassCache: true,
});
}
Expand Down

0 comments on commit 01add4b

Please sign in to comment.