From 1dbd46ec99c5c22427dd6dc0edce37c6fecc9f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zarach?= Date: Tue, 26 Mar 2024 14:47:59 +0100 Subject: [PATCH] fix(nuxt): ignore fetch errors in `getLatestManifest` (#26486) --- .../src/app/plugins/check-outdated-build.client.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/nuxt/src/app/plugins/check-outdated-build.client.ts b/packages/nuxt/src/app/plugins/check-outdated-build.client.ts index 0a7731d6e4..d8187d04d8 100644 --- a/packages/nuxt/src/app/plugins/check-outdated-build.client.ts +++ b/packages/nuxt/src/app/plugins/check-outdated-build.client.ts @@ -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(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(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 } }