Unverified Commit ddeadc1d authored by Gerald Monaco's avatar Gerald Monaco Committed by GitHub

Defer Page Registration (#11054)

parent 72e5b8db
...@@ -53,7 +53,9 @@ const asPath = getURL() ...@@ -53,7 +53,9 @@ const asPath = getURL()
const pageLoader = new PageLoader(buildId, prefix) const pageLoader = new PageLoader(buildId, prefix)
const register = ([r, f]) => pageLoader.registerPage(r, f) const register = ([r, f]) => pageLoader.registerPage(r, f)
if (window.__NEXT_P) { if (window.__NEXT_P) {
window.__NEXT_P.map(register) // Defer page registration for another tick. This will increase the overall
// latency in hydrating the page, but reduce the total blocking time.
window.__NEXT_P.map(p => setTimeout(() => register(p), 0))
} }
window.__NEXT_P = [] window.__NEXT_P = []
window.__NEXT_P.push = register window.__NEXT_P.push = register
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment