Hi,
I would like to keep the state of a specific page in history (with Turbo caching).
On the website I work, we chose an opt-in Turbo behaviour so I disable it with Turbo.session.drive = false.
The specific page is a page with results loaded by the fetch javascript function.
When I come back on this page, I would like to use the “Restoration Visit” principle (get the page in the same previous state).
To enable Turbo, I add data-turbo=true on each link of the results.
Turbo seems to be enabled because I see the progress bar between the pages but I meet several issues :
After clicking on a result and before the new page is loaded, the page scrolls to the begining. I think I lost the scroll position at this time and the browser don’t scroll to the previous state when I come back on the results page.
When I come back on the results page, the previous results loaded with fetch are not present. And even if “turbo:before-cache” was called on this page, I wonder if it was correctly cached because I can’t find any data-turbo-preview attribute.
Is it possible to debug the turbo cache ? How can I be sure that Turbo is correctly enabled ? What have I missed ? Any help would be appreciated.