diff --git a/packages/sui-react-web-vitals/src/index.js b/packages/sui-react-web-vitals/src/index.js index e4775ad57..f391c2e88 100644 --- a/packages/sui-react-web-vitals/src/index.js +++ b/packages/sui-react-web-vitals/src/index.js @@ -105,6 +105,7 @@ export default function WebVitalsReporter({ path: pathname, target, loadState: attribution.loadState, + visibilityState: document.visibilityState, ...(attribution.eventType && {eventType: attribution.eventType}) }) } diff --git a/packages/sui-react-web-vitals/test/browser/indexSpec.js b/packages/sui-react-web-vitals/test/browser/indexSpec.js index ee2ad7e93..bf6260950 100644 --- a/packages/sui-react-web-vitals/test/browser/indexSpec.js +++ b/packages/sui-react-web-vitals/test/browser/indexSpec.js @@ -36,7 +36,7 @@ describe('WebVitalsReporter', () => { await screen.findByRole('heading', {name: 'Title'}) }) - it('should track cwv using logger callback', async () => { + it('should track cwv using callback', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -49,7 +49,7 @@ describe('WebVitalsReporter', () => { await waitFor(() => [expect(onReport.calledWithMatch({name: 'TTFB', amount: 10, pathname: '/'})).to.be.true]) }) - it('should track cwv using logger callback with route id', async () => { + it('should track cwv using callback with route id', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -67,7 +67,7 @@ describe('WebVitalsReporter', () => { ]) }) - it('should track cwv using logger with browser', async () => { + it('should track cwv using callback with browser', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -91,7 +91,7 @@ describe('WebVitalsReporter', () => { ]) }) - it('should track cwv using logger with browser in context', async () => { + it('should track cwv using callback with browser in context', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10})