We are using StimulusReflex and want to change the URL on specific reflexes (e.g. using the Browser pushState
API, e.g. via cable_ready ??).
Is this a common thing with StimulusReflex? Are there good examples somewhere?
We are using StimulusReflex and want to change the URL on specific reflexes (e.g. using the Browser pushState
API, e.g. via cable_ready ??).
Is this a common thing with StimulusReflex? Are there good examples somewhere?
Yes, you can update the URL using cable ready:
class SomeReflexClass
def your_reflex
cable_ready.push_state(url: new_url, state: {turbo: true})
end
end
With turbo links setting the state to turbo: true
was necessary for turbo links to handle the back button correctly, not sure if it still necessary with Turbo Drive