Skip to content

Commit 552f3b4

Browse files
prateekbhTimer
andcommitted
fixing observing paint types in safari bug (vercel#10076)
* fixing observing paint types in safari bug * using try catch for performanceObserver fallback Co-authored-by: Joe Haddad <timer150@gmail.com>
1 parent 3aa6edb commit 552f3b4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/next/client/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,19 @@ function renderReactElement(reactEl, domEl) {
292292
}
293293

294294
if (onPerfEntry && ST) {
295-
if (!('PerformanceObserver' in window)) {
296-
window.addEventListener('load', () => {
297-
performance.getEntriesByType('paint').forEach(onPerfEntry)
298-
})
299-
} else {
300-
performance.getEntriesByType('paint').forEach(onPerfEntry)
301-
302-
// Start an observer to catch any paint metrics which may fire _after_
303-
// the load event is fired on the window
295+
try {
304296
const observer = new PerformanceObserver(list => {
305297
list.getEntries().forEach(onPerfEntry)
306298
})
307-
observer.observe({ entryTypes: ['paint'] })
299+
// Start observing paint entry types.
300+
observer.observe({
301+
type: 'paint',
302+
buffered: true,
303+
})
304+
} catch (e) {
305+
window.addEventListener('load', () => {
306+
performance.getEntriesByType('paint').forEach(onPerfEntry)
307+
})
308308
}
309309
}
310310
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy