Using Infinite Scroll with Turbo

Hi,

I am using Infinite-Scroll with its button load configuration to append more items to a grid of items on a page I have.

It works fine, but the URL updating is very flaky. I have disabled Infinite Scroll’s own history option as I hear it doesn’t work well with Turbo or previously TurboLinks.

I have tried to add:

infScroll.on('append', (body, path, items, response) => {
    // Manually push URL to the Turbolinks history
    Turbo.navigator.history.push(path)
})

but it doesn’t appear to do anything? Is there something I’m doing wrong here?

If I use Infinite Scrolls own history option, then the URL does update when new items are appended, but when I navigate to a new page and click the Back button, it all falls over and fails to go back correctly. This is why I was told a while back (when I was using TurboLinks) that I have to use TurboLinks own way of adding to the history but this doesn’t seem to be working.

Why does Turbo use it’s own history etc?

I’m not very clued up in the JS or Rails worlds so just stumbling around trying to figure things out in regards to all this.

Many thanks,
Neil