Skip to content

Commit a94d336

Browse files
author
Joan León
authored
Merge pull request #1727 from SUI-Components/feat/cwv-skip-empty-target
feat(packages/sui-react-web-vitals): skip empty targets
2 parents 6a5d77d + 0ae4b24 commit a94d336

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ export default function WebVitalsReporter({
100100
const pathname = getPathname(route)
101101
const routeid = getRouteid()
102102
const isAllowed = allowed.includes(pathname) || allowed.includes(routeid)
103+
const target = getTarget({name, attribution})
103104

104-
if (!isAllowed || !logger?.cwv || rating === RATING.GOOD) return
105+
if (!isAllowed || !logger?.cwv || rating === RATING.GOOD || !target) return
105106

106-
const target = getTarget({name, attribution})
107107
const {loadState, eventType} = attribution
108108

109109
logger.cwv({

0 commit comments

Comments
 (0)