mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): ignore fetch errors in getLatestManifest
(#26486)
This commit is contained in:
parent
67c664656c
commit
1dbd46ec99
@ -14,10 +14,14 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
const currentManifest = await getAppManifest()
|
||||
if (timeout) { clearTimeout(timeout) }
|
||||
timeout = setTimeout(getLatestManifest, 1000 * 60 * 60)
|
||||
const meta = await $fetch<NuxtAppManifestMeta>(buildAssetsURL('builds/latest.json') + `?${Date.now()}`)
|
||||
if (meta.id !== currentManifest.id) {
|
||||
// There is a newer build which we will let the user handle
|
||||
nuxtApp.hooks.callHook('app:manifest:update', meta)
|
||||
try {
|
||||
const meta = await $fetch<NuxtAppManifestMeta>(buildAssetsURL('builds/latest.json') + `?${Date.now()}`)
|
||||
if (meta.id !== currentManifest.id) {
|
||||
// There is a newer build which we will let the user handle
|
||||
nuxtApp.hooks.callHook('app:manifest:update', meta)
|
||||
}
|
||||
} catch {
|
||||
// fail gracefully on network issue
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user