Skip to content

Commit

Permalink
fix: run po for longtask only once (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperOleg39 authored Jan 29, 2023
1 parent c72d215 commit 47df005
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const logMetric = ({attribution, name, rating, value, navigationType}: Me
fcp.value = value;
}
// TODO Add docs
if (['FCP', 'LCP'].includes(name)) {
// create longtask observer only once, otherwise entries will be duplicated
if (['FCP', 'LCP'].includes(name) && !perfObservers[0]) {
perfObservers[0] = po('longtask', initTotalBlockingTime);
}
// TODO Add docs
Expand Down

0 comments on commit 47df005

Please sign in to comment.