diff --git a/.yarn/cache/@bbc-web-vitals-npm-2.5.3-3b7fffc29e-66490e7c0c.zip b/.yarn/cache/@bbc-web-vitals-npm-2.5.3-3b7fffc29e-66490e7c0c.zip deleted file mode 100644 index 364fb51c82e..00000000000 Binary files a/.yarn/cache/@bbc-web-vitals-npm-2.5.3-3b7fffc29e-66490e7c0c.zip and /dev/null differ diff --git a/.yarn/cache/@bbc-web-vitals-npm-2.6.0-6d875ed33b-e2c6bd863f.zip b/.yarn/cache/@bbc-web-vitals-npm-2.6.0-6d875ed33b-e2c6bd863f.zip new file mode 100644 index 00000000000..7696777b96b Binary files /dev/null and b/.yarn/cache/@bbc-web-vitals-npm-2.6.0-6d875ed33b-e2c6bd863f.zip differ diff --git a/package.json b/package.json index 2b066e1b6c7..8979bc79d78 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ }, "dependencies": { "@bbc/reverb-url-helper": "https://mybbc-analytics.files.bbci.co.uk/reverb-url-helper/bbc-reverb-url-helper-2.5.0.tgz", - "@bbc/web-vitals": "2.5.3", + "@bbc/web-vitals": "2.6.0", "@emotion/cache": "11.14.0", "@emotion/react": "11.14.0", "@emotion/server": "11.11.0", diff --git a/scripts/bundleSize/bundleSizeConfig.js b/scripts/bundleSize/bundleSizeConfig.js index 610650ad578..fd2d65a0eb6 100644 --- a/scripts/bundleSize/bundleSizeConfig.js +++ b/scripts/bundleSize/bundleSizeConfig.js @@ -9,5 +9,5 @@ export const VARIANCE = 5; -export const MIN_SIZE = 944; -export const MAX_SIZE = 1446; +export const MIN_SIZE = 935; +export const MAX_SIZE = 1437; diff --git a/src/app/components/PageLayoutWrapper/index.tsx b/src/app/components/PageLayoutWrapper/index.tsx index c40384d7f81..182db566f04 100644 --- a/src/app/components/PageLayoutWrapper/index.tsx +++ b/src/app/components/PageLayoutWrapper/index.tsx @@ -56,6 +56,9 @@ const PageLayoutWrapper = ({ const pageType = pageData?.metadata?.type; const reportingPageType = pageType?.replace(/ /g, ''); const isOfflinePage = pageType === OFFLINE_PAGE; + const isWindowValid = typeof window !== 'undefined'; + const shouldRenderWebVitals = isWindowValid && !isErrorPage && !isOfflinePage; + let wordCount: wordCountType = 0; if (pageType === 'article') { @@ -225,7 +228,7 @@ const PageLayoutWrapper = ({ )} - {!isErrorPage && !isOfflinePage && } + {shouldRenderWebVitals && }