Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: multiple of the same custom element - during ssr - will load the last element's property value for all #6125

Closed
3 tasks done
johnjenkins opened this issue Jan 27, 2025 · 1 comment · Fixed by #6126
Closed
3 tasks done
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted

Comments

@johnjenkins
Copy link
Contributor

johnjenkins commented Jan 27, 2025

Prerequisites

Stencil Version

Latest

Current Behavior

During SSR, given a component:

@Component({
  tag: 'my-component',
  shadow: true,
})
export class MyApp {
  @Prop() aProp;

  render() {
    return <Host>My Prop: {this.aProp}</Host>;
  }
}

Used like:

  <my-component></my-component>
  <my-component a-prop="second-component"></my-component>

The outputted HTML will be something like:

<my-component class="hydrated" s-id="3">
...
My Prop: second-component
</my-component>

<my-component a-prop="second-component" class="hydrated" s-id="4">
...
My Prop: second-component
</my-component>

^^ the last set a-prop will be rendered in all components.

After the client script takes-over, the correct state will then be set.

Expected Behavior

Component should not 'share' their initial props in anyway.

System Info

Steps to Reproduce

https://stackblitz.com/edit/stencil-start-6at4nont?file=views%2Fmultiple-component.html,src%2Fcomponents%2Fmulti-component.tsx

Click on 'mulitple-component' < the client side script has intentionally not been included.

Code Reproduction URL

https://stackblitz.com/edit/stencil-start-6at4nont?file=views%2Fmultiple-component.html,src%2Fcomponents%2Fmulti-component.tsx

Additional Information

Image

@christian-bromann
Copy link
Member

This has been released in @stencil/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants