[Live] Fixed idiomorph id child handling & JavaScript cleanup #1484
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.
Hi!
TODO:
Sorry, quite a lot going on here to get morphing & child rendering just right after switching to Idiomorph. The referenced tickets exposed a few cases that were not handled by the tests:
IMPORTANT CHANGES
data-live-id
is nowid
. That's because Idiomorph usesid
as its special key. So it's time to embrace that.ChildComponentA
were changed toChildComponentB
in the same location. Under some situations, we would NOT swap for the new HTML, and would instead "refresh"ChildComponentA
.ChildComponentB
correctly, theLiveController
would still be attached to aComponent
object representingChildComponentA
. That would cause problems later on. We now watch for theid
attribute to change, and then re-create a newComponent
if changed.data-live-preserve
attribute for elements that want to keep their current element. Improved handling of this.OTHER CHANGES
data-live-emit
were changed to Stimulus values, likedata-events-to-emit-value
. These are not attributes the user ever sets directly.morph:started
andmorph:finished
Cheers!