Skip to content
Discussion options

You must be logged in to vote

So, this is an issue in the sense that your connectedCallback here is not idempotent.

the connectedCallback is invoked every time the element is added to a document, NOT when the element is created.

So if Alpine moves the elements around, as it does with x-for, the element can get connected each time it moves.

Ideally, you should make your connectedCallback idempotent so calling it multiple times doesn't cause issues.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TheSteveBurgess
Comment options

Answer selected by TheSteveBurgess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants