article --summary
The summary
The article starts from a common Livewire problem: when rows in a list lack a proper wire:key, or the key changes between renders, deleting or reordering an item can leave the wrong client-side state attached to the wrong row. Nested components can end up holding stale data for the same reason.
Richardson walks through choosing stable keys based on record identity rather than position, and shows how to prefix keys for rows and child components so they do not collide. The examples focus on keeping Alpine state and nested component data tied to the correct item.
He closes by explaining what server-side tests can confirm about rendered output and what they cannot, since the bug lives in how the browser patches the DOM. Readers who maintain Livewire lists will find it useful for both the fix and the testing strategy.
Editorial note: This is a summary of an article first published by freek.dev. The full piece is on their site.