From c06bf49be79decbbfab341113a295d94cbfc284e Mon Sep 17 00:00:00 2001 From: Thanh Vu Date: Wed, 9 Mar 2022 15:36:11 +0700 Subject: [PATCH] fix: fix refesh tab on chrome --- src/scripts/popup.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scripts/popup.ts b/src/scripts/popup.ts index ee826cf..8510aa6 100644 --- a/src/scripts/popup.ts +++ b/src/scripts/popup.ts @@ -49,14 +49,15 @@ function onOctotreeCheckboxChange() { } function reloadCurrentTab() { - const code = 'window.location.reload();'; if (browserName === 'chrome') { - chrome.tabs.getSelected(function (tab) { - chrome.tabs.executeScript(tab.id as number, { code }); + chrome.tabs.query({ active: true }, (tabs) => { + chrome.tabs.reload(tabs[0].id as number); }); } else { browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => { - browser.tabs.executeScript(tabs[0].id as number, { code }); + browser.tabs.executeScript(tabs[0].id as number, { + code: 'window.location.reload();', + }); }); } buttonSession.classList.add('hide');