Skip to content

Commit 8456cdf

Browse files
committed
fix: reset vis watcher
1 parent fad1bbe commit 8456cdf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/browser-utils/src/metrics/web-vitals/lib/getVisibilityWatcher.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ const onVisibilityUpdate = (event: Event) => {
6161
}
6262
};
6363

64-
export const getVisibilityWatcher = () => {
64+
export const getVisibilityWatcher = (reset = false) => {
65+
if (reset) {
66+
firstHiddenTime = Infinity;
67+
}
68+
6569
if (WINDOW.document && firstHiddenTime < 0) {
6670
// Check if we have a previous hidden `visibility-state` performance entry.
6771
const activationStart = getActivationStart();

0 commit comments

Comments
 (0)