From a64ff0856ac10a40544d8af160c6aab5db3f4693 Mon Sep 17 00:00:00 2001 From: Max Duval Date: Thu, 25 Aug 2022 09:44:51 +0100 Subject: [PATCH] fix: safe performance.getEntriesByType Some browsers do not support this method, so we check for its existence before measuring the time taken. Fixes CLIENT-SIDE-PROD-CSXR Fixes CLIENT-SIDE-PROD-CTRH --- dotcom-rendering/src/web/browser/islands/doHydration.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dotcom-rendering/src/web/browser/islands/doHydration.ts b/dotcom-rendering/src/web/browser/islands/doHydration.ts index 5e26a2e5e70..ed0165e6c9a 100644 --- a/dotcom-rendering/src/web/browser/islands/doHydration.ts +++ b/dotcom-rendering/src/web/browser/islands/doHydration.ts @@ -48,6 +48,8 @@ export const doHydration = ( return { clientOnly, timeTaken }; }) .then(({ clientOnly, timeTaken }) => { + if (!('getEntriesByType' in window.performance)) return; + // Log performance info const { duration: download = -1 } = window.performance