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

jj63systems's avatar

wire:click not firing,..?

Hi I have this blade code (excerpt)

Notice the wire:click 4 lines from the bottom? Well it doesn't appear to be firing. There is a function in the corresponding controller defined thus

public function toggleState($id, $isActive)
    {
        // Update the database here
        //dd($id);
        Log::info('toggleState');
        $record = YourModel::find($id);
        if ($record) {
            $record->is_active = $isActive;
            $record->save();
        }
    }

I would hope to see something in the laravel.log file but see nothing.

The other livewire stuff in the first part of blade code is working as expected.

This is Livewire V3 (and am running this within a Filament3 environment). Is there something wrong with the structure?

Appreciate any pointers, totally new to livewire.

thanks j

1 like
5 replies
LaryAI's avatar
Level 58

To troubleshoot the issue with the wire:click not firing in your Livewire component, here are a few steps and considerations:

  1. Ensure Livewire is Loaded Correctly: Make sure that Livewire scripts are properly included in your layout. Typically, this is done with @livewireScripts in your Blade template, usually placed before the closing </body> tag.

  2. Check for JavaScript Errors: Open your browser's developer console and check for any JavaScript errors that might be preventing Livewire from functioning correctly.

  3. Verify Component Registration: Ensure that the Livewire component is correctly registered and that the method toggleState exists in the component class.

  4. Parameter Mismatch: Double-check the parameters being passed to the toggleState method. Ensure that the IDs and values are correct and match what the method expects.

  5. Event Bubbling: If the button is nested within other clickable elements, the event might not be reaching the Livewire component. You can try adding wire:click.stop to prevent event propagation issues.

  6. Check for Caching Issues: Sometimes, caching can cause unexpected behavior. Clear your application cache using:

    php artisan cache:clear
    php artisan view:clear
    php artisan config:clear
    
  7. Debugging: Add a dd() or Log::info() statement at the beginning of the toggleState method to ensure it's being called. If it's not, the issue might be with the event not being triggered.

  8. Livewire Version Compatibility: Since you mentioned using Livewire V3, ensure that all your components and syntax are compatible with this version. Check the Livewire documentation for any breaking changes or updates.

Here's a refined version of your button with wire:click.stop:

<button type="button"
    class="flex w-full disabled:pointer-events-none justify-start text-start"
    wire:click.stop="toggleState('{{ $result->id }}', 'x')">
    <div class="fi-ta-icon flex gap-1.5 px-3 py-4">
        <svg id="heroicon{{ $result->id }}">
        <!-- SVG content -->
        </svg>
    </div>
</button>

If none of these steps resolve the issue, consider creating a minimal reproducible example and testing it in isolation to identify the problem.

vincent15000's avatar

There is perhaps some conflicts between Filament and Livewire ?

Merklin's avatar

Did you try renaming the function? Because toggleState sounds a bit like a system function, that can be used somewhere. I think there was a .js function with this name.

1 like
jj63systems's avatar
jj63systems
OP
Best Answer
Level 2

@Merklin Thanks for the tip, though to no avail - renamed to toggleSvgState but no difference.

There is nothing in the browser console log nor in the laravel.log to give me any clues as to what is wrong - it's quite silently doing nothing!

Blade code

<button type="button"
class="flex w-full disabled:pointer-events-none justify-start text-start"
wire:click.stop="toggleSvgState('2345','x')">

Ah

Later on, within the code for the SVG we had a javascript onclick

onclick="event.stopPropagation(); changeIconColor('{{ $result->id }}');"

Removing this obviously suppresses some behaviour but I now find the wire:click is executing - and of course, it was the event.stopPropagation that was inhibited (I assume) stuff "higher" in the structure from firing.

1 like

Please or to participate in this conversation.