Query string to session?

Are you using the latest version of Livewire: yes

I am updating the query string as detailed here: https://laravel-livewire.com/docs/properties#update-query-string

I need to make the query string available for the next request via the session. Is it possible to hook into Livewire at some stage to facilitate this?

Maybe I don’t understand your question, cant you just put the variable that tracks your query string into the session?

Hm… which var would that be? I have:

protected $updatesQueryString = [

Do you mean I need to append each var to some session array when the state of the public variable changes?

I don’t know how to answer that. It’s all about what you need stored in the session so you can use it elsewhere.

Ok, thanks. Do you know which api Livewire uses to manipulate the query string?

It’s built in.

You have a property on the back end, lets say public $search;, and you tell Livewire to track it in the query string using the updatesQueryString array. A combination of middleware that handles hydration/dehydration and javascript keeps the url in your browser’s address bar synced with the value of $search.

If the query string in the updatesQueryString array is present on the initial page load, livewire pulls the value of it from the regular Laravel request object and assigns it to the property.

Would it be possible to hook into the hydration/dehydraton methods using Javascript?