alpinejs / alpine

A rugged, minimal framework for composing JavaScript behavior in your markup.
https://alpinejs.dev
MIT License
27.92k stars 1.22k forks source link

Remove extra destroyTree call #4151

Closed c4710n closed 4 months ago

c4710n commented 5 months ago

destroyTree is hooked into mutation.js by lifecycle.js#L22, and will be called when an element is removed.

If we call it again, then we call it twice.

This PR removes the extra call, and it also eliminates the dependency-cycle between lifecycle.js and mutation.js.

calebporzio commented 4 months ago

Ah good catch. How did you find that it was being called twice?

c4710n commented 4 months ago

I didn't find this issue through actual usage. I discovered it while reading the source code, as I was very interested in how Alpine is built.

calebporzio commented 4 months ago

Gotcha, good eye! I tested and you're right, it was getting called twice! Thanks