Skip to content

Commit

Permalink
double connected call issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDoge committed Dec 26, 2024
1 parent 9966a12 commit ddbb5b2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,10 @@ export let WithLifecycle = <Base extends new (...params: any[]) => HTMLElement>(

effect(callback: Lifecycle.OnConnected<this>): Lifecycle.OffConnected {
this.#connectedCallbacks.add(callback)
if (this.isConnected) {
// Commented because causes issues when custom element defined while also being already connected
/* if (this.isConnected) {
this.#disconnectedCallbacks.push(callback(this))
}
} */

return () => {
this.#connectedCallbacks.delete(callback)
Expand Down

0 comments on commit ddbb5b2

Please sign in to comment.