Turbo Frames with advance and Browser History

Our code base uses a turbo frame with data-turbo-action=advance to connect frame navigations to browser history. With Turbo 7, when we clicked a link that targeted the frame it would open as expected and the URL would change. Clicking browser back would revert the page to the state before the link was clicked. After Turbo 8, when we click browser back button the URL changes but there is no change to the HTML – the frame content that was loaded remains as-is.

Furthermore when we click “forward” after back does nothing, the browser loads the frame’s URL as a whole page.

This seems like a major change in the behaviour of frames and snapshots between Turbo 7 and 8, but I’m struggling to find any explanation in the documented changes as to what might be going on.

Has anyone else experienced this issue? Should I file a bug?

Reproduction here:

I’ve triaged this to a change to Turbo to no longer use the head from the current document when promoting a Frame visit. This was an intentional change to allow turbo frame responses to include header changes, but it seems like a major regression if it breaks browser history.

Created an issue here with a reproduction: Turbo Frame Responses missing tracked elements · Issue #580 · hotwired/turbo-rails · GitHub

Does this mean no one else is promoting turbo frame visits? (confused)

1 Like