History navigation with turbo-stream updates

I am re-populating a list on the page by sending a turbo-stream request and returning a turbo-stream tag with action=replace. It works great.

When the turbo-stream request is sent, I push a new url onto Turbo.navigator.history, intending that the back-button will then pop from this history vs. a new turbo-stream server request. However it doesn’t pull from history, it does generate a new turbo-stream request.

Is my strategy wrong, and that’s why it’s not working?

could you provide more context, if possible?

thanks for taking the time to respond @rockwell. After struggling with turbo-streams and the back-button behaviour for some time, I abandoned the approach and implemented with turbo-frames, and finally got it working.

1 Like

Please, could you show how did you get it done with turbo frames? I think I’m in the same place. I’m using turbo-streams to replace some components in the view, but then I have some issues. And with turbo-frames I can’t maintain the scroll position. I’d appreciate your help!