Navigating Turbo Frames

Hi Everyone,

This is my first post here, really looking forward to getting super involved with the Hotwire community. In fact, Jose Farias and I are working on a book about The Hotway.

I’m working on an example for the book where I’m rebuilding the GitHub file browser UI. I have a main frame defined in the view for the file browser, <turbo-frame id="file_browser"> . Within that frame are links <a href="/browser/<%= node.path %>">. The backend will send back the view which contains <turbo-frame id="file_browser"> and the frame redraws and it’s magic and awesome. However, because it’s a frame, the URL does not change. It would seem that there’s no way to have a frame navigation event (a frame being redrawn) add to the history session stack. I understand I could implement this myself, but I’m wondering if this is by design or what all your thoughts about that are? I think there’s a lot of good reasons to be able to have a frame navigation event also be represented in the session history. Happy to explain more, but wanted to see what everyone thought and if the issue is clear.

Also - is there a Discord/Slack where the community is discussing Turbo/Hotwire/Rails? I’d love to chat more - I’m so excited about this evolution to the rails ecosystem.

<3

Avi Flombaum

1 Like

So currently I think the “right” way would be to just replace the whole page instead of a fragment. I know that sounds expensive and it kind of is, but when the URL changes the idea is that the page is changing. Re-rendering the navigation is (relatively) cheap.

However there is some talk of making turbo frames control the URL: Push state and updating URLs with Turbo Frames · Issue #50 · hotwired/turbo · GitHub

Also relevant topic: Turbo link inside frame not updates browser history and url - #2 by danott

I don’t think there’s a Slack/Discord type community due to Basecamp’s thoughts on it: Is group chat making you sweat? - Signal v. Noise. Overall for communities a forum is a lot better for maintaining knowledge and making it easier to find (as I’ve hopefully done in this post :slight_smile:)

Hopefully, that helps! Welcome to the community :wave:t2: :slight_smile: