Bandwidth and server resources

Hello everyone
i have a Livewire Real-time Validation thought

I noticed it sends a request for each input to validate

This does not make sense
Because the rules for validation is Constant

I think it would be good if Livewire loads the rules at the begining from the Backend
And for Real-Time just validate in the frontend without requesting the Backend

This way it would save the server resources
+
help the visitors with poor Internet connection from being forced to send alot of requests just for One Form

Note: of Course it has to be validated again after the submit in the backend for security matters.

You can Lazy it, or Defer it to cut requests. Outside of that, livewire is essentially a server side rendering package with state tracking and some other niceties.

So that would be outside of the scope of livewire, and you would use a typical javascript validation instead, though it’s probably possible to inject those rules with livewire via scripting.

I think the idea of Livewire is to stop me from using vue or Angular but give me the same performance in an easy code

They should inject that if possible in the future

Yeah, I think originally that was the goal, but then it changed. The home page used to say something to the affect of “Javascript frameworks suck, here’s this where you can write it in php.” Now it’s basically “Javascript frameworks suck, I made alpine, so use these instead.”

There were originally a lot more front end features built into livewire that were removed, and the docs heavily push alpine now. I don’t think your idea is a bad one by any means, I think it’s just outside of the current scope of the direction livewire has gone.

However, in my opinion, any attempt to enact change will be wasted trying to do it through the forums. The way I look at it is the forums are for people to help each other with the current feature set, while discussions within the github repo are for bug fixes and new stuff. You can just look at @calebporzio profile here, he hasn’t posted or replied to anyone in over a year through the forums.

I think your idea would be a good one to develop a front/back package that integrates with livewire, or just reach for one of the ones that encompasses laravel as a whole.

Well this is going to be bad for the traffic

However i will use it to save my time with debounce 1200ms and Voilà… :slight_smile:

Thank you very much for your reply

Some validation rules will need that request though. For example if you’re checking if a name is unique in the database.

I haven’t tried this with Livewire but I would assume if you defer all the inputs and then just use a Javascript validation library, or your own Javascript validation rules for real time stuff.

Hope this helps.