This repo provides a minimal example of an issue we are having url parameter binding in Livewire v3.
Component: https://github.com/jszobody/url-param-binding-v3/blob/main/app/Livewire/Binding.php
We have a basic route parameter injected in the mount()
method, stored as a Livewire public property, and changed with a method.
In Livewire v2, changing the parameter would automatically update the URL. See the v2 repo to see this in action:
https://github.com/jszobody/url-param-binding-v2/blob/main/README.md
In v3, the exact same code no longer updates the URL:
The best workaround I've found is to:
- Generate a new URL server-side, store in a public parameter
- Entangle this client-side in alpine
$watch
for changes and usehistory.pushState
to update the URL
Component: https://github.com/jszobody/url-param-binding-v3/blob/main/app/Livewire/Workaround.php