fix(web-extension): beforeunload logic (#1330)
This commit is contained in:
5
.changeset/witty-kids-talk.md
Normal file
5
.changeset/witty-kids-talk.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@rrweb/web-extension': patch
|
||||
---
|
||||
|
||||
🐞 fix(web-extension): beforeunload logic
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user