Hi there,
When using $updatesQueryString = […] so the url can be updated, I’ve noticed that navigations aren’t added to the browser history.
If the user lands on a page with a Livewire component, interacts with the component and changes the url a few times, and then clicks “back” in their browser - they’re taken to the page before the component page instead of the previous state on the same page.
I’d like to suggest that history.pushState() is used instead of history.replaceState() when navigating.
The documentation for this feature mentions that this is useful when the user hits the back button so I think it’s the desired behaviour.
Some further changes would also need to be made to handle the popstate event - so the content on the page is updated.
A possible conflict could occur where both Livewire and the website itself wants to handle this popstate. Some details could be added to the state data so Livewire knows to ignore states it didn’t push, but the developer using Livewire would need to be aware about Livewire’s states if they also want to handle them.