fix(nuxt): ensure runtimeConfig.public is reactive on client (#28443)

This commit is contained in:
Daniel Roe 2024-08-07 13:51:13 +01:00 committed by GitHub
parent acea730a6b
commit f40e36a3fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
import { hasProtocol, joinURL, withoutTrailingSlash } from 'ufo'
import { parse } from 'devalue'
import { useHead } from '@unhead/vue'
import { getCurrentInstance, onServerPrefetch } from 'vue'
import { getCurrentInstance, onServerPrefetch, reactive } from 'vue'
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
import type { NuxtPayload } from '../nuxt'
@ -122,6 +122,10 @@ export async function getNuxtClientPayload () {
...window.__NUXT__,
}
if (payloadCache!.config?.public) {
payloadCache!.config.public = reactive(payloadCache!.config.public)
}
return payloadCache
}