Skip to content

Commit

Permalink
nit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh committed Feb 13, 2020
1 parent 3d1c457 commit f125280
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/next/client/index.js
Expand Up @@ -338,8 +338,14 @@ function renderReactElement(reactEl, domEl) {
return []
}
}

function observeSupportedTypes(entryTypes) {
const supportedTypes = getSupportedTypes(entryTypes)

/**
* Layout shift has special handling as this will be sent
* cumulative layout shift.
*/
if (supportedTypes.includes('layout-shift')) {
// Stores the current layout shift score for the page.
let cumulativeLayoutShiftScore = 0
Expand Down Expand Up @@ -367,7 +373,8 @@ function renderReactElement(reactEl, domEl) {
}
})
}
// Start observing paint entry types.

// For all other entry types, we send values to relayer as given by PerformanceObserver
supportedTypes.forEach(type => {
if (type === 'layout-shift') {
return
Expand All @@ -387,7 +394,6 @@ function renderReactElement(reactEl, domEl) {
'layout-shift',
])
} catch (e) {
console.log({ e })
window.addEventListener('load', () => {
performance.getEntriesByType('paint').forEach(onPerfEntry)
})
Expand Down

0 comments on commit f125280

Please sign in to comment.