I have a fully functioning Turbo-powered site with everything working great except one single page which is powered by a non-Turbo stream API. It’s a legacy page with a handful of Handlebars templates. This, too, works really well given the legacy code being plugged in…but every time a handlebars template is rendered, the URL is updated with the latest API state. It is here I need to write to the Turbo history stack.
Using the browser back/forward buttons to navigate pre-Turbo would rely on a popState event to update the page with the handlebars template corresponding to the state… but now Turbo doesn’t “know” about the page change so going back/forward changes the URL but nothing else happens.
This is the closest I’ve found but doesn’t help in our situation.
https://discuss.hotwired.dev/t/manually-setting-history-state/
In Turbolinks, we used replaceHistoryWithLocationAndRestorationIdentifier
and pushHistoryWithLocationAndRestorationIdentifier
… but nothing like this exists AFAIK.
Thanks!