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

dsdevelopers's avatar

dsdevelopers wrote a comment+100 XP

3mos ago

Everything New in Livewire 4: Ep 13, Optimistic UI with wire:show

@christogonus selectedOption becomes an object, not an array, after selection—so .length is undefined; use an object-safe check like:

wire:show="selectedOption.id"
dsdevelopers's avatar

dsdevelopers liked a comment+100 XP

3mos ago

Everything New in Livewire 4: Ep 13, Optimistic UI with wire:show

@Weasel - mmm yeah I could see that. all wire: directives have always been JS actually. We just didn't really advertise that to avoid confusion like this. Most wire: directives are actually the equivalent Alpine directives under-the-hood (just with the scope of $wire provided automatically if that makes sense)

Good feedback that wasn't obvious to me though, thanks