-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)
Description
Astro Info
Astro v5.17.1
Vite v6.4.1
Node v25.2.1
System macOS (arm64)
Package Manager pnpm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Custom web components that are wrapped in a template tags prevent further instances of the component from initialising correctly.
Here is how I came across this issue:
- CartLine component is rendered in a tag and later cloned to create the Cart
- CartLine component contains a custom web component which adds multiple event listeners in its connectedCallback() function
- web component is also used later on in the document, in the AddToCart component
- Because it's first mounted within the tags, the AddToCart instance of the QuantitySelector doesn't have its event listeners initialised
Note that order is important here: If I simply mount a hidden component before the CartLine tags, all instances of the are correctly initialized.
It's only when the first instance of the is found within tags, do all of the instances of the fail to initialise.
What's the expected result?
Custom web components should initialise correctly, even if the first instance is mounted with tags.
Link to Minimal Reproducible Example
https://stackblitz.com/~/github.com/lairdkruger/astro-web-components-template-issue
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)