perf(nuxt): remove state from nuxt island response (#26863)

This commit is contained in:
Julien Huang 2024-04-20 03:56:56 +02:00 committed by GitHub
parent 3a1137e2b8
commit f0902f9301
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 12 deletions

View File

@ -77,7 +77,6 @@ export interface NuxtIslandContext {
export interface NuxtIslandResponse { export interface NuxtIslandResponse {
id?: string id?: string
html: string html: string
state: Record<string, any>
head: { head: {
link: (Record<string, string>)[] link: (Record<string, string>)[]
style: ({ innerHTML: string, key: string })[] style: ({ innerHTML: string, key: string })[]
@ -496,7 +495,6 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
id: islandContext.id, id: islandContext.id,
head: islandHead, head: islandHead,
html: getServerComponentHTML(htmlContext.body), html: getServerComponentHTML(htmlContext.body),
state: ssrContext.payload.state,
components: getClientIslandResponse(ssrContext), components: getClientIslandResponse(ssrContext),
slots: getSlotIslandResponse(ssrContext), slots: getSlotIslandResponse(ssrContext),
} }

View File

@ -2029,7 +2029,6 @@ describe('component islands', () => {
}, },
"html": "<pre data-island-uid> Route: /foo "html": "<pre data-island-uid> Route: /foo
</pre>", </pre>",
"state": {},
} }
`) `)
}) })
@ -2088,7 +2087,6 @@ describe('component islands', () => {
], ],
}, },
}, },
"state": {},
} }
`) `)
}) })
@ -2117,7 +2115,6 @@ describe('component islands', () => {
"html": "<div data-island-uid> This is a .server (20ms) async component that was very long ... <div id="async-server-component-count">2</div><div class="sugar-counter"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><!--[--><div style="display: contents;" data-island-uid data-island-slot="default"><!--teleport start--><!--teleport end--></div><!--]--></div>", "html": "<div data-island-uid> This is a .server (20ms) async component that was very long ... <div id="async-server-component-count">2</div><div class="sugar-counter"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><!--[--><div style="display: contents;" data-island-uid data-island-slot="default"><!--teleport start--><!--teleport end--></div><!--]--></div>",
"props": {}, "props": {},
"slots": {}, "slots": {},
"state": {},
} }
`) `)
}) })
@ -2144,7 +2141,6 @@ describe('component islands', () => {
}, },
"html": "<div data-island-uid> ServerWithClient.server.vue : <p>count: 0</p> This component should not be preloaded <div><!--[--><div>a</div><div>b</div><div>c</div><!--]--></div> This is not interactive <div class="sugar-counter"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><div class="interactive-component-wrapper" style="border:solid 1px red;"> The component bellow is not a slot but declared as interactive <!--[--><div style="display: contents;" data-island-uid data-island-component="Counter"></div><!--teleport start--><!--teleport end--><!--]--></div></div>", "html": "<div data-island-uid> ServerWithClient.server.vue : <p>count: 0</p> This component should not be preloaded <div><!--[--><div>a</div><div>b</div><div>c</div><!--]--></div> This is not interactive <div class="sugar-counter"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><div class="interactive-component-wrapper" style="border:solid 1px red;"> The component bellow is not a slot but declared as interactive <!--[--><div style="display: contents;" data-island-uid data-island-component="Counter"></div><!--teleport start--><!--teleport end--><!--]--></div></div>",
"slots": {}, "slots": {},
"state": {},
} }
`) `)
expect(teleportsEntries).toHaveLength(1) expect(teleportsEntries).toHaveLength(1)
@ -2224,12 +2220,6 @@ describe('component islands', () => {
bool: false bool: false
}</pre></div>" }</pre></div>"
`) `)
expect(result.state).toMatchInlineSnapshot(`
{
"$shasRouter": true,
}
`)
}) })
it('test client-side navigation', async () => { it('test client-side navigation', async () => {