Skip to content

Commit

Permalink
fix: safe performance.getEntriesByType
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mxdvl committed Aug 25, 2022
1 parent 6bf9d21 commit a64ff08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dotcom-rendering/src/web/browser/islands/doHydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a64ff08

Please sign in to comment.