Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue with morph, where if the key already exists in the DOM and is to be moved up during morph, it wasn't getting moved correctly.
The reason was, that
fromKeyDomNodeMap
was empty, so thefromKeyNode
in the below snippet was always empty, so the move "from" key was never running.alpine/packages/morph/src/morph.js
Lines 259 to 265 in a920616
Removing the commented out
keyToMap(fromChildren)
got it working, but then caused an infinite loop. This was due todom.replace()
replacing the old with the new, but leaving the new one in its place in the array, causing two references to the dom node. So then when anydom.()
methods run and try to find the index of the node, there would be two of them but only the first was ever returned. I opted to updatedom.replace()
but this could also be done in the above from key move code.This fixes livewire/next#99
There is a failing test
directives/x-bind-style.spec.js
but running those tests locally they pass, so I believe it's unrelated.Hope this helps!