Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Loots's avatar
Level 4

wire:click not working

I have a really weird bug with livewire. I created a split screen view with a client list on the left side and details of one selected client on the right side. I have two buttons that are controlled by livewire on the detailed view, the update action and the delete action. When I load the page, both actions work fine and I can repeat the update action multiple times for the same client. But when I update one client and switch to another one (also controlled by a wire:click action) I can't do the update action anymore. The delete action still works fine. The weird thing is, when I added a second button that's exactly the same beneath the original button, the second button works, but the first doesn't.

            <div class="mt-3">
                <x-jet-secondary-button class="px-3" wire:click="showUpdateClientForm({{ $client->id }})">
                    Aanpassen
                </x-jet-secondary-button>
            </div>

            <div class="mt-3">
                <x-jet-secondary-button class="px-3" wire:click="showUpdateClientForm({{ $client->id }})">
                    Aanpassen
                </x-jet-secondary-button>
            </div>
0 likes
4 replies
Loots's avatar
Level 4

After trying a lot of different things. I found this:

https://github.com/livewire/livewire/issues/1012

The problem was that I didn't had an id for the button. I'm not sure if it's a bug, because sometimes it works, sometimes it doesn't. But adding an id solved the issue for me.

prospero's avatar

Also remember you can use the wire:key, in cases of dynamic elements of looping through collections that are rendered in the blade (eg. table with actions buttons) you can add to them

<button wire:key="button-update-{{$item->id}}"></button>
<button wire:key="button-delete-{{$item->id}}"></button>
1 like
Loots's avatar
Level 4

Thanks! But the weird thing is, I have such a table with action buttons and I don't use wire:key and it still works fine...

I will add it, just to be sure though.

abdonor's avatar

in my case wire:click button was not working, because i had style tag with some css in the blade file, removing it, the button works.

Please or to participate in this conversation.