question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Visiting the current URL doesn't reload the turbo frame

See original GitHub issue

I have a link that points to the current URL (acting as a reload button), and it targets a turbo frame.

Clicking on the link the first time works; the frame is reloaded, and the src value of the frame is updated. Clicking on the link the second time doesn’t work, there are no HTTP requests being made, and the frame is not reloaded.

I’m assuming it’s because Turbo doesn’t detect that src has changed, since it’s the same link. However, this is not how regular links behave, you can always visit the current page, so I think it would make sense for Turbo to have the same behaviour.

Possibly related to https://github.com/hotwired/turbo/issues/249#issuecomment-830124904 and https://github.com/hotwired/turbo/issues/202.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
Bramjettencommented, Jun 28, 2021

I don’t understand why reloading the current URL is not allowed. This behaviour is counterintuitive to me. Adding a timestamp works as a temporary workaround. Reloading a frame can be useful to easily reset a frame’s initial state.

3reactions
jankocommented, Jun 7, 2021

Thanks for the reply. We initially used the approach of clearing the src first, but then we switched to adding a timestamp to the URL.

However, I don’t understand in which scenarios is this kind of caching useful. Personally, I would expect caching to only happen based on caching-related HTTP response headers.

I actually feel like this unexpected behaviour is coming from Turbo Frames possibly being designed to only watch for src changes on the frame, considering that navigateFrame only changes the frame’s src. In this case it’s obvious there is a limitation of not detecting reloads.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how can I reload a single turbo frame and update the url?
open index.html in a browser · click the 'full page' link, observe that bonus number changes, query string is now in URL and...
Read more >
Turbo Frames with Browser Destination/URL Replacement
I want to have the search query “persist” between page navigation and so I used a Turbo Frame to do exactly that with...
Read more >
Turbo Frames Vs. Turbo Streams - Learn Ruby on Rails
Turbo Frames are great for taking an old-style full-HTML page and turning it into a modern, responsive-looking page in minutes.
Read more >
Using Rails Turbo Frames
Turbo Frames is a set of tools that can replace complex, ... from links in the background without needing to perform a full...
Read more >
Making a Single Page Search with Turbo
This happens because each turbo-frame creates its own navigational context. By default all links and form submissions from within a given turbo- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found