Happy to be corrected by :key is not a shorthand for wire:key
:key is used when you need to pass a key into a child component
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a Livewire table. In this each row has a visible content row and a hidden content row. All works fine in the normal state.
When I filter the rows using search, the ID's are messed up. I can't understand why. When I am using the same ID from the for loop, why does LW changes these ID's?
In the second image, the results are filtered. You could see the actual ID from the for loop in the table, but LW is not picking the correct ID's for the "hidden" rows (in the filtered mode). Why?
I am pasting the code snippet below...
<tbody class="text-gray-600 text-sm font-light">
@foreach ($questions as $question)
<tr class="" :key="{{ $question->id }}">
<td class="">
{{-- removed all other TD's --}}
</td>
<td class="py-3 px-6 text-center justify-center">
<div>
<button
x-on:click="showQues = {{ $question->id }}"
name="showMoreButton{{ $question->id }}"
class=""
x-text="{{ $question->id }}"
>
</button>
</div>
</td>
</tr>
<tr
x-show="showQues === {{ $question->id }}"
class=""
:key="{{ $question->id }}"
>
<td>
<div>Content</div>
</td>
</tr>
@endforeach
</tbody>
Happy to be corrected by :key is not a shorthand for wire:key
:key is used when you need to pass a key into a child component
Please or to participate in this conversation.