instantsearch: urlSync + Turbolinks back button not working
I am using the using instantsearch with turbolinks and am experiencing an issue where the back button is not working correctly.
My search coffeescript
search = instantsearch(
appId: 'id'
apiKey: 'key'
indexName: 'index'
urlSync: {
threshold: 300
})
When I search products, the url is updated as expected, search works. If I click on a product, than click the back
button, the url changes to the previously generated search url, but I stay on the product#show page for the instance I was viewing. Clicking back
button a second time takes me to the root /products page.
This issue doesn’t occur when setting useHash: true
, unfortunately analytics team needs this to be query params.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (15 by maintainers)
Closing this issue in favor of https://github.com/algolia/instantsearch.js/issues/2998
Yes totally, especially since it was an option of the urlSync. From what I can read about turbolinks, the project is very much black magic 😅
I’m not quite sure how turbolinks works in practice. I don’t know if you store the attribute in the history data would it still work. Could you try to remove the turboLinks attribute from the URL using a custom createURL function https://community.algolia.com/instantsearch.js/v2/guides/routing.html#historyopts?
@Haroenv amazing 😃 Seems like a good thing to add into a migration guide (maybe the one for preparing v3?)
@Haroenv it seems to work perfectly! Thanks