mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): allow omitting fallback
in island response (#25296)
This commit is contained in:
parent
28b58c9145
commit
ce7845cbcf
@ -134,7 +134,7 @@ export default defineComponent({
|
||||
|
||||
return html.replaceAll(SLOT_FALLBACK_RE, (full, slotName) => {
|
||||
if (!currentSlots.includes(slotName)) {
|
||||
return full + payloadSlots[slotName]?.fallback ?? ''
|
||||
return full + (payloadSlots[slotName]?.fallback || '')
|
||||
}
|
||||
return full
|
||||
})
|
||||
|
@ -64,7 +64,7 @@ export interface NuxtIslandContext {
|
||||
|
||||
export interface NuxtIslandSlotResponse {
|
||||
props: Array<unknown>
|
||||
fallback: string
|
||||
fallback?: string
|
||||
}
|
||||
export interface NuxtIslandClientResponse {
|
||||
html: string
|
||||
@ -626,7 +626,7 @@ function getSlotIslandResponse (ssrContext: NuxtSSRContext): NuxtIslandResponse[
|
||||
for (const slot in ssrContext.islandContext.slots) {
|
||||
response[slot] = {
|
||||
...ssrContext.islandContext.slots[slot],
|
||||
fallback: ssrContext.teleports?.[`island-fallback=${slot}`] || ''
|
||||
fallback: ssrContext.teleports?.[`island-fallback=${slot}`]
|
||||
}
|
||||
}
|
||||
return response
|
||||
|
@ -1825,7 +1825,6 @@ describe('component islands', () => {
|
||||
"html": "<div data-island-uid><div> count is above 2 </div><!--[--><div style="display: contents;" data-island-uid data-island-slot="default"></div><!--]--> that was very long ... <div id="long-async-component-count">3</div> <!--[--><div style="display: contents;" data-island-uid data-island-slot="test"></div><!--]--><p>hello world !!!</p><!--[--><div style="display: contents;" data-island-uid data-island-slot="hello"></div><!--teleport start--><!--teleport end--><!--]--><!--[--><div style="display: contents;" data-island-uid data-island-slot="fallback"></div><!--teleport start--><!--teleport end--><!--]--></div>",
|
||||
"slots": {
|
||||
"default": {
|
||||
"fallback": "",
|
||||
"props": [],
|
||||
},
|
||||
"fallback": {
|
||||
@ -1854,7 +1853,6 @@ describe('component islands', () => {
|
||||
],
|
||||
},
|
||||
"test": {
|
||||
"fallback": "",
|
||||
"props": [
|
||||
{
|
||||
"count": 3,
|
||||
|
Loading…
Reference in New Issue
Block a user