mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): ensure prerendered components are treated as islands (#21583)
This commit is contained in:
parent
c73bed8c6d
commit
2a42a5f807
@ -79,6 +79,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
// TODO: Validate response
|
// TODO: Validate response
|
||||||
const result = await $fetch<NuxtIslandResponse>(url, {
|
const result = await $fetch<NuxtIslandResponse>(url, {
|
||||||
|
responseType: 'json',
|
||||||
params: {
|
params: {
|
||||||
...props.context,
|
...props.context,
|
||||||
props: props.props ? JSON.stringify(props.props) : undefined
|
props: props.props ? JSON.stringify(props.props) : undefined
|
||||||
|
@ -20,7 +20,10 @@ if (componentIslands) {
|
|||||||
revivers.Island = ({ key, params }: any) => {
|
revivers.Island = ({ key, params }: any) => {
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
if (!nuxtApp.isHydrating) {
|
if (!nuxtApp.isHydrating) {
|
||||||
nuxtApp.payload.data[key] = nuxtApp.payload.data[key] || $fetch(`/__nuxt_island/${key}`, params ? { params } : {}).then((r) => {
|
nuxtApp.payload.data[key] = nuxtApp.payload.data[key] || $fetch(`/__nuxt_island/${key}`, {
|
||||||
|
responseType: 'json',
|
||||||
|
...params ? { params } : {}
|
||||||
|
}).then((r) => {
|
||||||
nuxtApp.payload.data[key] = r
|
nuxtApp.payload.data[key] = r
|
||||||
return r
|
return r
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user