fix(nuxt): replace : in rendered server components (for win) (#21645)

This commit is contained in:
Daniel Roe 2023-06-19 23:06:46 +01:00 committed by GitHub
parent 9df892a17f
commit 3fd6c179e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ export default defineComponent({
})
async function _fetchComponent () {
const key = `${props.name}:${hashId.value}`
const key = `${props.name}_${hashId.value}`
if (nuxtApp.payload.data[key]) { return nuxtApp.payload.data[key] }
const url = `/__nuxt_island/${key}`

View File

@ -145,7 +145,7 @@ const getSPARenderer = lazyCachedFunction(async () => {
async function getIslandContext (event: H3Event): Promise<NuxtIslandContext> {
// TODO: Strict validation for url
const url = event.node.req.url?.substring('/__nuxt_island'.length + 1) || ''
const [componentName, hashId] = url.split('?')[0].split(':')
const [componentName, hashId] = url.split('?')[0].split('_')
// TODO: Validate context
const context = event.node.req.method === 'GET' ? getQuery(event) : await readBody(event)
@ -363,7 +363,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
}
}
if (process.env.prerender) {
ISLAND_CACHE!.set(`/__nuxt_island/${islandContext!.name}:${islandContext!.id}`, response)
ISLAND_CACHE!.set(`/__nuxt_island/${islandContext!.name}_${islandContext!.id}`, response)
}
return response
}