未验证 提交 e34e5e09 编写于 作者: J Joe Haddad 提交者: GitHub

Revert #14580 (#16757)

上级 808d6b94
......@@ -56,12 +56,6 @@ const relPreloadStyle = 'fetch'
const hasNoModule = 'noModule' in document.createElement('script')
const requestIdleCallback: (fn: () => void) => void =
(window as any).requestIdleCallback ||
function (cb: () => void) {
return setTimeout(cb, 1)
}
function normalizeRoute(route: string) {
if (route[0] !== '/') {
throw new Error(`Route name should start with a "/", got "${route}"`)
......@@ -281,8 +275,7 @@ export default class PageLoader {
const { pathname: hrefPathname } = parseRelativeUrl(href)
const route = normalizeRoute(hrefPathname)
return this.promisedSsgManifest!.then(
(s: ClientSsgManifest, _dataHref?: string) => {
requestIdleCallback(() => {
(s: ClientSsgManifest, _dataHref?: string) =>
// Check if the route requires a data file
s.has(route) &&
// Try to generate data href, noop when falsy
......@@ -292,9 +285,9 @@ export default class PageLoader {
`link[rel="${relPrefetch}"][href^="${_dataHref}"]`
) &&
// Inject the `<link rel=prefetch>` tag for above computed `href`.
appendLink(_dataHref, relPrefetch, 'fetch')
appendLink(_dataHref, relPrefetch, 'fetch').catch(() => {
/* ignore prefetch error */
})
}
)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册