Skip to content

Commit

Permalink
Fixes bug where Astro can't distinguish between two equal components …
Browse files Browse the repository at this point in the history
…differing only by props when hydrating (withastro#846)
  • Loading branch information
matsdahlin authored Jul 27, 2021
1 parent 38e497f commit c82f00e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/internal/__astro_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AstroComponentMetadata>);
const astroRoot = `<astro-root uid="${astroId}">${html}</astro-root>`;
return [astroRoot, script].join('\n');
Expand Down

0 comments on commit c82f00e

Please sign in to comment.