From c82f00ea27771f5491ccbfaa419df8d5dd964a4b Mon Sep 17 00:00:00 2001 From: Mats Date: Tue, 27 Jul 2021 14:52:17 +0200 Subject: [PATCH] Fixes bug where Astro can't distinguish between two equal components differing only by props when hydrating (#846) --- src/internal/__astro_component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/__astro_component.ts b/src/internal/__astro_component.ts index 1ddd40b05ced..9470e5b14765 100644 --- a/src/internal/__astro_component.ts +++ b/src/internal/__astro_component.ts @@ -187,7 +187,8 @@ export function __astro_component(Component: any, metadata: AstroComponentMetada } // If we ARE hydrating this component, let's generate the hydration script - const astroId = hash.unique(html); + const stringifiedProps = JSON.stringify(props); + const astroId = hash.unique(html + stringifiedProps); const script = await generateHydrateScript({ instance, astroId, props }, metadata as Required); const astroRoot = `${html}`; return [astroRoot, script].join('\n');