Skip to content

Conversation

@c4710n
Copy link
Contributor

@c4710n c4710n commented Apr 16, 2024

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
Copy link
Collaborator

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

@c4710n
Copy link
Contributor Author

c4710n commented Apr 18, 2024

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
Copy link
Collaborator

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

@calebporzio calebporzio merged commit b1fff5d into alpinejs:main Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants