Skip to content

Commit 50904fb

Browse files
committed
🐛 修复特殊tab处理的问题 #1066
1 parent 560cdc0 commit 50904fb

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/pages/popup/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { AppProvider } from "../store/AppContext.tsx";
1414
// 初始化日志组件
1515
const loggerCore = new LoggerCore({
1616
writer: new MessageWriter(message),
17-
labels: { env: "install" },
17+
labels: { env: "popup" },
1818
});
1919

2020
loggerCore.logger().debug("popup page start");

src/pkg/utils/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export function parseStorageValue(str: string): unknown {
8181
// https://developer.chrome.com/docs/extensions/reference/api/tabs?hl=en#get_the_current_tab
8282
export async function getCurrentTab(): Promise<chrome.tabs.Tab | undefined> {
8383
// `tab` will either be a `tabs.Tab` instance or `undefined`.
84-
const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true, windowType: "normal" });
84+
// 不要使用 windowType: "normal" ,否则在使用应用窗口时获取不到 tab 了
85+
const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true });
8586
if (tab?.discarded) return undefined;
8687
return tab;
8788
}

0 commit comments

Comments
 (0)