Skip to content

Commit 5474b97

Browse files
authored
Merge pull request #1676 from SUI-Components/feat-react-web-vitals-report-path-route-id
feat(packages/sui-react-web-vitals): add routeId field to logger
2 parents 42bc872 + ae46e13 commit 5474b97

File tree

1 file changed

+3
-1
lines changed
  • packages/sui-react-web-vitals/src

1 file changed

+3
-1
lines changed

packages/sui-react-web-vitals/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ export default function WebVitalsReporter({
9696
const handleAllChanges = ({attribution, name, rating, value}) => {
9797
const amount = name === METRICS.CLS ? value * 1000 : value
9898
const pathname = getPathname(route)
99-
const isAllowed = allowed.includes(pathname)
99+
const routeid = getRouteid()
100+
const isAllowed = allowed.includes(pathname) || allowed.includes(routeid)
100101

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

@@ -106,6 +107,7 @@ export default function WebVitalsReporter({
106107
name: `cwv.${name.toLowerCase()}`,
107108
amount,
108109
path: pathname,
110+
...(routeid && {routeId: routeid}),
109111
target,
110112
loadState: attribution.loadState,
111113
visibilityState: document.visibilityState,

0 commit comments

Comments
 (0)