Replies: 2 comments 3 replies
-
I think it fixed in latest version (3.14.7) |
Beta Was this translation helpful? Give feedback.
2 replies
-
I used this script since your initial example was not fully testable: <?php
namespace App\Livewire;
use DateTime;
use Livewire\Component;
class Test extends Component
{
public ?DateTime $date = null;
public function test(): void
{
$this->date = new DateTime();
$this->dispatch('show-modal');
}
public function save()
{
//
}
public function render()
{
return view('livewire.test');
}
} // test.blade.php
<div>
<button type="button" wire:click="test">Test</button>
<div x-data="{ open: false }"
x-show="open"
x-init="
@this.on('show-modal', () => {
open = true;
})
">
<div class="p-4">
@if($this->date)
<div wire:click="save" x-bind:class="{ 'active': open }">Save</div>
@endif
</div>
</div>
</div> after clicking test, I can see |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After updating Alpine.js from version 3.14.3 to 3.14.4 (or higher), using Blade conditionals like @if($this->order) within a Livewire component's blade file are broken if $this->order is null when the component mounted.
I use Livewire 2.0, but I do not know if that makes a difference. It seems that the newer versions of the AlpineJS dom-diffing are incompatible from versions higher then 3.14.3 and are preventing attributes from being correctly set when using @if conditionals. Removing the @if directive restores the expected behavior.
Steps to Reproduce
Things tried that did not work:
Of course, the production code is much more complicated, but the below example is a working example of this bug.
Example code that fails since 3.14.4
So the gist of it is:
Beta Was this translation helpful? Give feedback.
All reactions