Skip to content

Commit

Permalink
feat(packages/sui-react-web-vitals): add routeId field to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
jordevo committed Dec 4, 2023
1 parent 5692699 commit 524a2ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/sui-react-web-vitals/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export default function WebVitalsReporter({
const handleAllChanges = ({attribution, name, rating, value}) => {
const amount = name === METRICS.CLS ? value * 1000 : value
const pathname = getPathname(route)
const isAllowed = allowed.includes(pathname)
const routeid = getRouteid()
const isAllowed = allowed.includes(pathname) || allowed.includes(routeid)

if (!isAllowed || !logger?.cwv || rating === RATING.GOOD) return

Expand All @@ -106,6 +107,7 @@ export default function WebVitalsReporter({
name: `cwv.${name.toLowerCase()}`,
amount,
path: pathname,
routeId: routeid,
target,
loadState: attribution.loadState,
visibilityState: document.visibilityState,
Expand Down

0 comments on commit 524a2ce

Please sign in to comment.