fix performance reset bug

This commit is contained in:
Francis Cao committed 2026-03-05 10:23:00 -08:00
1 parent f6a6d2cc31
commit 1730d495e5
2 files changed
+12 -2

No files matched your search

+11 -1
View File
@@ -331,7 +331,17 @@
send({ ...getPayload(), ...metrics }, 'performance');
};
flushPerformance = sendPerformance;
flushPerformance = () => {
sendPerformance();
Object.keys(metrics).forEach(k => {
delete metrics[k];
});
clsValue = 0;
inpValue = 0;
sent = false;
if (timeoutId) clearTimeout(timeoutId);
timeoutId = setTimeout(sendPerformance, 10000);
};
timeoutId = setTimeout(sendPerformance, 10000);
document.addEventListener('visibilitychange', () => {