I have a page where we display embedded tableau dashboards and on the same page there is a dropdown using which which user can load different dashboards, on click of the dropdown options I call Turbolinks.visit(url, {action: 'replace'})
STEP 1: The first time user opens a dashboard the link will be https://www.example.com/dashboards/56
STEP 2: The user clicks one of the dropdown options "My custom view" in the dropdown, Turbolinks.visit
executes and the url will be https://www.example.com/dashboards/56?filter_id=12
STEP 3: The user can now interact with the dashboard apply different filters, which results in a totally different view from the view which was a result of STEP 2, but this does not change the URL but changes the view
STEP 4: The user now tries to click dropdown option "My custom view" again to go back to earlier version of view, but Turbolinks.visit
does not open the URL as the URL did not change
My question is How do i force Turbolink.visit(url, {action: replace})
to always visit the page even if its on the same page?
Any help in this would be great.
Update 1: I need to reload the same page using Turbolinks. the Turbolink.visit does not trigger if i provide the same page url, it does work if i provide a different url.
How can i use Turbolinks.visit to visit / reload the same page.
It's working as expected, I had the below code which was preventing the reload on the same page
$(document).on('turbolinks:before-visit', function(event) {
if (event.originalEvent.data.url == window.location.href) {
event.preventDefault();
}
});