fix: dedupe hashes for identical islands (#1660)

This commit is contained in:
Nate Moore 2021-10-26 11:00:55 -07:00 committed by GitHub
parent c85c7e2188
commit 55c8453fd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -239,7 +239,8 @@ export async function renderComponent(result: SSRResult, displayName: string, Co
return html.replace(/\<\/?astro-fragment\>/g, '');
}
const astroId = shorthash.unique(html);
// Include componentExport name and componentUrl in hash to dedupe identical islands
const astroId = shorthash.unique(`<!--${metadata.componentExport!.value}:${metadata.componentUrl}-->\n${html}`);
result.scripts.add(await generateHydrateScript({ renderer, astroId, props }, metadata as Required<AstroComponentMetadata>));