where are wire:key ?
May 19, 2025
2
Level 6
The Like/Dislike buttons disappear for all but the first recipe after changing the sort order. Livewire 3
Hello
Problem description:
In my RecipeList.php I am showing the list of recipes:
@forelse($recipes as $recipe)
<x-recipe-card :recipe="$recipe"/>
@empty
<p>error</p>
@endforelse
Inside <x-recipe-card :recipe="$recipe"/> I have another livewire component:
<livewire:like-dislike :recipe="$recipe"/>
Upon the initial page load, the like buttons are displayed correctly on all cards. However, as soon as I change the sorting ($sort) within the same parent component, RecipeList, the buttons only remain on the first recipe, while they disappear from all subsequent ones.
Sequence Of Steps:
- Load recipe list page (pagination, default sorting "popularity").
- Like/Dislike buttons are visible on each recipe card.
- Select "newest" or "oldest" in the dropdown sorting list.
- Problem: The first recipe still has buttons, but the rest have disappeared.
Conclusion:
How can i make the parent component RecipeList.php be able to track the child LikeDislike.php provided that it is in the blade component
Please or to participate in this conversation.