note to self: never use livewire on client sites. Maybe for personal new sites is okay but don't throw it on legacy stuff. You will get white hairs
Hi. Can you explain why? Why would you not use it for client work?
I'm slowly adding Livewire to a legacy site that I'm using. It feels weird that the UI works differently on some pages, but if I keep taking it slow then it isn't causing any issues. It's a great way to start upgrading my site to use newer technologies.
For me it was more than one reason. I had to build a pretty long "form" wizard with many steps and many columns and I decided to build a form builder in livewire. Firstly I tried to ad the livewire component inside a normal blade page.
This dind't work and whatever I did I got the issues with "snapshot not found for id x".
Then I tried full page components but then they didn't support blade layots so I had to duplicate my layouts.
Then i did the error to use the single input field as a component (similarly to vue.js) and this forced me to use events to update data from children to parent.
Then after filling the components I got errors with interactivity again, some filelds had to be conditionally displayed ( user chosen what kind of entity they are company/person and company fields where displayed accordingly). This triggered errors again and slowdowns.
Then i did the error to use the single input field as a component (similarly to vue and this forced me to use events to upload ....
to use events to update data between the children input field and the parent form container containing the logic.
Then I had problems with fields being live, as this would slow down the site and occasionally trigger the snapshot error again.
I disabled liveness for all except the entity type selected from above. This solves my snapshot issue, but now I have a problem with saving, not all input changes were recognized. In the end, I had to not use livewire to select, but use "legacy" post forms to collect the fields and send the data to my endpoint.
Also, I never got the livewire form validation and errors to work correctly.
Passing to the legacy post solved my problems.
I need to specify that this was a legacy bootstrap site and probably an issue occurred because the bootstrap / jQuery were changing some DOM of the page.
I used livewire on some smaller sites, and it was OK, but they had very shorter input forms to handle.
I think you're wrong about generalizing the "Clients" maybe no for the Legacy sites, but why not on Non-legacy clients websites?
Because If it's a personal project I can afford to delay it but clients have deadlines to respect.
From my personal experience livewire is not stable enough yet for clients requiring stable experience and fat turn around. I'm almost sure the issue came from integrating legacy ad livewire but it because of this bad choice of mine I had to spend some mentally tiring 3 weeks and delay a second project which I was working in the meantime (50/50 time sure).
I repeat it was my fault for experimentating with new tech on clients projects.
Here i described my experience better alpha.coz.jp/X3mdRb
Try creating one Livewire component per page and using alpine/blade components everywhere else. I use traits when pages have the same elements. Otherwise you'll run into problems with events and slots.
yes this is my experience too, more or less. In this other pinkary thread I described it better alpha.coz.jp/X3mdRb but in the end the php driven reactivity is not solid enough yet, but it has potential for the future.
This really needs to be a whole blog post:
Livewire is solid but not a replacement for JS frameworks.
The idea is most apps don't need a JS framework because the content needs to be SEO and interactions ought to trigger a network request. Just use a powerful server framework and something simple like jQuery or Alpine for interactivity.
Livewire is better described as a protocol like Inertia. All you have to do is type in a method name and Livewire will serialize data and invoke the PHP function for you. (The protocol works by defining server components)
In Inertia, it's less straightforward, but serialization is in the hands the developer. This makes Inertia more compatible across tech stacks than Livewire, and this means you can have SSR for an existing JS frontend.
For me it was about finding Livewire's purpose. Now that I understand when to use multiple server components (and that Inertia is limited in this area), Livewire has been able to handle every feature I can think of.
I know how data should be saved in livewire but In my case it didn't work because I was probably using it wrong. Overall this is my limited experience with the tool. my other other side projects that I built from scratch are built on livewire and they just work. like adventcalendar.tech