-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: already init component #3951
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably handle tracking initialization tracking in the initialization process, not the mutation process.
036254c
to
8a3ba01
Compare
The only way to apply this on the node is to execute it on the mutation. Otherwise, we have to rewrite a big part of the lifecycle system.
FINALLY I found a way to make it works ... waiting for CI to be sure Thx @ekwoka for your time and help, really appreciated |
Thanks! I do think the implementation is a little heavy handed. I instead just changed the addedNodes and removedNodes to JS |
Does that solve the actual issue this is meant to solve? It still will incorrectly consider an element that is added and immediately moved as being a "moved" element and never initialize it, which was the issue. |
It was my first though but it was more complex and didn't fix well the issue :/ |
Currently we defined if a mutation is a move operation if the node is in the
addedNodes
and in theremovedNodes
.However in some case, an element is added, removed and added again. So it should considered as
add
+move
operations. But alpine will ignore it, considering it as a move operation only (so nothing will be init).The PR focus on introducing a new state
_x_isInit
that will be true for component that are initialized.Also it may speed up a little bit the
onMutate
function. Previously we checked every deleted nodes before adding any new nodes. For big mutations, iterate over thedeletedNodes
several times could be CPU intensive.