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

[Live] Fixed idiomorph id child handling & JavaScript cleanup #1484

Merged
merged 1 commit into from Feb 14, 2024

Conversation

weaverryan
Copy link
Member

@weaverryan weaverryan commented Feb 9, 2024

Q A
Bug fix? yes
New feature? yes
Issues Fix #1470 Fix #1472
License MIT

Hi!

TODO:

  • Finish fixing minor js tests

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

  • A) data-live-id is now id. That's because Idiomorph uses id as its special key. So it's time to embrace that.
  • B) Fixed a bug if ChildComponentA were changed to ChildComponentB in the same location. Under some situations, we would NOT swap for the new HTML, and would instead "refresh" ChildComponentA.
  • C) In the above situation, even when we DID swap to ChildComponentB correctly, the LiveController would still be attached to a Component object representing ChildComponentA. That would cause problems later on. We now watch for the id attribute to change, and then re-create a new Component if changed.
  • D) Removed special "morph" handling for children components (which are always empty). Instead added a new data-live-preserve attribute for elements that want to keep their current element. Improved handling of this.

OTHER CHANGES

  • Various internal attributes like data-live-emit were changed to Stimulus values, like data-events-to-emit-value. These are not attributes the user ever sets directly.
  • Moved the remaining JS child handling into a plugin
  • Added morph:started and morph:finished
  • Simplified "child" handling. Previously we really tried to keep track of our children as they were attached / detached. Now, if we need to know our children, we loop over all components to find children.

Cheers!

@smnandre
Copy link
Collaborator

smnandre commented Feb 9, 2024

Wow that's some major changes :)

Every one of them make perfect sense and, as we said a few times already, "better change while still experimental" :)

Is this the perfect time to create our missing UPGRADE.md file ?

@weaverryan weaverryan force-pushed the live-idiomorph-id-child-handling branch from 8b742fc to 6d59382 Compare February 14, 2024 16:17
@weaverryan weaverryan merged commit e3c270b into symfony:2.x Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review Needs to be reviewed
Projects
None yet
3 participants