if its livewire, why does the query string need to be easy for a human to read?
Query string array format best practice?
In my livewire component I have an certain amount of features to filter on. If i store the features in an array I get an ugly query string like: ?features[0]=firstfeature&features[1]=secondfeature&features[2]=thirdfeature&...
I don't like this because it can get very long very fast and also it's not as readable as for example: ?features=firstfeature,secondfeature,thirdfeature,...
How to work around this and make transform the array in to a nice querystring?
For now, I am working around it using Vanilla JS and a decicated hidden field in the blade view. When you click a feature checkbox, in JS split the field value to an array, remove checkbox value if unchecked and push checkbox value if checked, merge back to string, finally dispatch the input event so Livewire can handle changes.
Is this the way to do it? Or is there a different way available in LiveWire?
My checkboxes have no wire:model=. I am just listening to changes by querySelector().
It feels a bit strange going back to Vanilla JS while inside a Livewire component. Sure it works, but I'm just using Livewire for a filter component, might as well just ajax it. :-\
Thanks!
Please or to participate in this conversation.