Livewire form and outside form with button action maybe different your think
In liveiwre word some button action and alpine @click action be clicked, livewire 3 update (ajax) is different your think.
Component
public $test_input=1;
public function tt()
{
info('tt');
info($this->test_input);
}
blade
<div class="row row-cols-1 row-cols-md-3 g-4" x-data>
<form wire:submit="tt">
<input type="text" wire:model='test_input'>
<button type="submit">form type=submit</button> {{-- // update (ajax) --}}
<button type="button">form type=button</button> {{-- // No update (ajax) --}}
<button wire:click='tt; $wire.test_input=3;'>form wire:click</button> {{-- // update (ajax) and run twice --}}
<button @click='$wire.tt; $wire.test_input=3;'>form @click</button> {{-- // update (ajax) and run twice --}}
</form>
<button type="submit">out form type=submit</button> {{-- // No update (ajax) --}}
<button type="button">out form type=button</button> {{-- // No update (ajax) --}}
<button wire:click='tt; $wire.test_input=3;'>out form wire:click</button> {{-- // update (ajax) --}}
<button @click='$wire.tt; $wire.test_input=3;'>out form @click</button> {{-- // update (ajax) --}}
</div>
So be careful and try to understand
- what time public variable have value or be set value
- run twice, not run one.