fix(web-extension): beforeunload logic (#1330)

This commit is contained in:
huangkairan
2026-04-01 12:00:00 +08:00
committed by GitHub
parent a8dcca54d8
commit 228a72e1e8
2 changed files with 6 additions and 1 deletions

View File

@@ -155,8 +155,8 @@ async function initMainPage() {
// Before unload pages, cache the new events in the local storage.
window.addEventListener('beforeunload', (event) => {
if (!newEvents.length) return;
event.preventDefault();
if (newEvents.length === 0) return;
void Browser.storage.local.set({
[LocalDataKey.bufferedEvents]: bufferedEvents.concat(newEvents),
});