-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
Title:
Flux button shows loading state on all buttons when used inside @foreach loop
Description:
When using <flux:button> with wire:click inside a @foreach loop, clicking on one button triggers the loading state on all buttons instead of only the clicked button.
However, when buttons are defined individually (not in a loop), the loading state works correctly and only appears on the clicked button.
Steps To Reproduce:
- Create a Livewire component with flux buttons inside a @foreach loop
- Add
wire:clickaction to each button - Click on any button
Code example that shows the bug:
@foreach($this->districts as $zone)
<flux:button wire:click="selectZone({{ $zone->id }})" size="xs">Open</flux:button>
@endforeachExpected behavior: Only the clicked button should show loading state
Actual behavior: All buttons in the loop show loading state
Working example (without foreach):
<flux:button wire:click="selectZone(1)" size="xs">Open</flux:button>
<flux:button wire:click="selectZone(2)" size="xs">Open</flux:button>
<flux:button wire:click="selectZone(3)" size="xs">Open</flux:button>In this case, only the clicked button shows loading state (correct behavior).
Environment:
- Laravel version: 12.53.0
- Livewire version: 4.2.1
- Flux version: 2.12.1
Screenshot:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels