Skip to content

Commit

Permalink
fix: prevent opening multiple Automa dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Sep 23, 2022
1 parent db10afd commit 723bf1f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/newtab/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ browser.runtime.onMessage.addListener(({ type, data }) => {
(async () => {
try {
const tabs = await browser.tabs.query({
url: browser.runtime.getURL('/newtab.html/*'),
});
if (tabs.length > 1) {
const firstTab = tabs.shift();
await browser.windows.update(firstTab.windowId, { focused: true });
await browser.tabs.update(firstTab.id, { active: true });
await browser.tabs.remove(tabs.map((tab) => tab.id));
return;
}
const { isFirstTime } = await browser.storage.local.get('isFirstTime');
isUpdated.value = !isFirstTime && compare(currentVersion, prevVersion, '>');
Expand Down

0 comments on commit 723bf1f

Please sign in to comment.