Suggestions on storing menu state

My requirement is to allow the user to minimize a left navigation pane. I now have this working using Alpine but as the user navigates, the page is reloaded and Alpine is initialized with the default value.

I could store the state on the user or in the session - any suggestions as to best handle this to ensure if the menu was minified, when I navigate to another route, that the menu stays minified?

Would it be better to switch this to a Livewire component? Use View composer? I can make this work but I could be overlooking a better way. Thanks for the help.

You can use cookie, local storage, async post request to store setting. Of cause you can wrap header into livewire component, but then you will re-render whole header every time you collapse/expand.

1 Like

Yes, I decided to do something simple and have a async post to set a session variable. Seems to work fine. Thanks for the suggestions.