fix(nuxt): bypass browser cache when fetching app build id (#25813)

This commit is contained in:
Michał Zarach 2024-02-16 18:03:42 +01:00 committed by GitHub
parent 4fd4f95d48
commit 06352e350d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ 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'))
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)