Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra destroyTree call #4151

Merged
merged 1 commit into from
Apr 18, 2024
Merged

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
1 check passed
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