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
parent e64f8c9f3d
commit 93801def67
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

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
}