Dev Diary #2: going deeper with Livewire
I’ve had some really productive work days recently - which is awesome - but one thing is actually irking me: working on a current project in Inertia with Vue.
I fear I made some choices early in the process which has in turn made it more time consuming than is needed to get new features built in the app. I really do love Vue… but after playing more with Livewire over the last couple of weeks, can see that for a lot of my project work, Livewire may be a more efficient choice for development.
Since I last wrote a Dev Diary I’ve expanded my Livewire playground, including:
writing tests for Livewire components,
Blade components
tables,
modals,
sharing a single modal for any row of the table (i.e. a “delete” modal), which required
event dispatching through Alpine, and
writing a component to explore more of Livewire and Alpine’s reactivity behaviour
Oh, and getting my head around Tailwind 4’s new way of doing things.
I think the big thing holding me back with Livewire is that commentators online have criticised Livewire for performance problems, and losing form data - but I do believe this relates to v2, not v3.
So today I created a new “Math Test” component - its purpose is to have 3 quick-to-update public integer properties, with a computed property that multiplies them all together.
The simulation here is that there is some complex business logic that is part of that computed property that I would want to have happen server-side, not have to code for both PHP and Alpine.
Setting my browser’s throttling to GPRS, sure there’s a delay with updating the new total, as you’d expect, and sometimes even staggers it - i.e. picks up 1 and 2 have changed before it knows 3 was changed (even though it was) and it still all works as expected.
In other words, no data loss to the user.
So I’m happy with that.
I do think I need to start to write a bit more of an app-type thing, rather than my playground, to get a bit more of a real-world understanding: but my playground has helped build confidence, and demonstrate how Laravel Idea can help with generating stubs for the Blade and Livewire world.
I’ve got a current project that I thought would (could?) use Livewire but don’t think it is actually necessary for the bulk of the app - but may be for a simple form component - but another project on the radar I feel will be all in with Livewire. Which is exciting - and by the time that comes around, Laravel 12 will be out, as well as Flux 2.0, so am looking forward to the new starter kits (just to see how the Laravel team do things), see more of Flux, and see its potential for a full-scale app too.
Happy days. I’m really enjoying this booked-out time on Fridays.