Say you have a list of N users with turbo frame IDs derived from their User ID:
<div>
<turbo-frame id="user_id_1" />
<turbo-frame id="user_id_2" />
...
</div>
Say you want to link to a list of pets of each user:
<turbo-frame id="user_id_1>
<a href="..." data-turbo-frame="pet_id_1">pet1</a>
<a href="..." data-turbo-frame="pet_id_2">pet2</a>
...
</turbo-frame>
… and then you want to navigate from the pet frame back to the user:
<turbo-frame id="pet_id_1>
<a href="..." data-turbo-frame="user_id_1">owner</a>
</turbo-frame>
… and the catch: you want the navigation to happen within the same Turbo Frame DOM element.
So: <turbo-frame id="user_id_1" />
would become <turbo-frame id="pet_id_1" />
and then <turbo-frame id="user_id_1" />
again.
Is there any way to do this with Turbo Frames only?
I know I can return a stream response along the linea of <turbo-stream action="replace" target="user_id_1"><template><turbo-frame id="pet_id_1" /></template></turbo-stream>
I just wonder if there is automagical way to replace a frame with another frame, not just content of a frame with a different content of a frame with the same ID.