I have 2 select
s where changes to the first select
refresh the second select
.
I am using onChange
on the first select
with Turbo.visit
to trigger a re-rendering:
onChange:"Turbo.visit(`/sites/index_by_country?country_id=${this.value}`)"
This calls a controller method that renders a turbo_stream
, updating the turbo_frame_tag
around the second select
.
def index_by_country
...
render turbo_stream: turbo_stream.update(...)
end
This works nicely, the second select
is refreshed, however when I do this, the ‘Turbo.visit’ changes the URL.
What can I do to not change the URL?
I want it to remain the same, no matter how often I change the first select.