-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
[LiveComponent] Sharing templates between child components broken since 2.14 #1470
Comments
I installed your reproducer and i did not reproduced the problem: Enregistrement.de.l.ecran.2024-02-07.a.21.26.25.movCould this be a cache problem ? |
Did you update to 2.14 ( |
Enregistrement.de.l.ecran.2024-02-07.a.21.38.46.mov |
I tried clearing cache, removing project and reinstalling from github, but I keep getting the same. I have no clue why it behaves normally on your machine. I installed it also on a dev server for anyone to test: http://livebug.tijnema.com |
It is probably related to major changes that occured in the morphin algorithm... as you remove a node in the same time you add one, it seems their is some confusion and the final result is .... surprising indeed. The only short-term solution is see for you there is to help the morphing, wrapping your two components (tested on my machine, but you know...) <div id="foo-a">
{% if this.even %}
{{ component('child_a') }}
{% endif %}
</div>
<div id="foo-b">
{% if not this.even %}
{{ component('child_b') }}
{% endif %}
</div> |
@smnandre is correct about the morphing algorithm change. I can see the problem - I'm checking into it. |
Since live component 2.14 we can no longer use child components inside a parent component with the same template. The child components will generate the same live id.
I've created a reproducer here: https://github.com/tijnema/livebug
In the current state it shows how it should work (live components version 2.13), pressing the button will render child A or B.
Upgrading live components to 2.14 breaks it, and will either render the wrong component, or render nothing at all.
The text was updated successfully, but these errors were encountered: