turbo: Progress bar is not shown when using Turbo Frames (even with turbo-action="advance")
Hi,
The documentation specifically mentions that the progress bar is for Turbo Drive but if you use Turbo Frames with URL history support such as when using <a href="/profile" data-turbo-frame="main" data-turbo-action="advance">
then it’s somewhat expected that the progress bar would be shown here because this page transition may happen within 50ms or 5000ms due to external network events that’s out of our control.
You can test that it’s not being shown by adding a sleep 1
between Turbo Frame page transitions and not seeing the progress bar where as if you remove the frame so that Turbo Drive picks it up then the progress bar is shown. This is with v7.1.0
.
Can we make a case here to show the progress bar for all Turbo Frame events regardless of it being done with turbo-action="advance"
? I’m guessing this was very thoroughly investigated at Hey / Basecamp but that discussion isn’t in the issue tracker here. Am I missing something important that would make showing the progress bar for all Turbo Frame events a bad idea?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 16
- Comments: 25 (5 by maintainers)
We looked at invoking the progress bar for everything, but that didn’t seem right. You can have a lot of frames triggering for lazy loading. It would be a very busy progress bar.
What I’d rather do is have an option to explicitly opt-in to using the progress bar when it’s not a full page replace. Could be as simple as
data-turbo-progress-bar=true
.👍 it would be a great addition to frames, as a temporary solution:
Any updates on this?
When using turbo_frame to update content from a slow page it’s really useful to have a progress bar. How can I force the progress bar to shows up?
For the moment I solved using this
Yeah, I’d say it’s fair for this to default to true when we use advance. But I’d love to see this as a general control. Then you could also negate. Like data-turbo-progress-bar=false on an advance to NOT show it.
thanks for taking this on @zhisme ❤️
no updates regarding a review / merge yet?
@marcoroth ready for review
@zhisme I think the general idea of having a
data-turbo-progress-bar
attribute that you can set on a<turbo-frame>
is something that could be added to the core library.Please feel free to explore this idea! Thank you!
Add progress bar and cursor waiting class from tailwind.
I used code from @onEXHovia and @leoplct. Thank you
app/javascript/turbo_progress_bar.js
Import this file in app/javascript/application.js
@mateuszbialowas Your solution is nice but after loading is finished progress bar instantly disappear instead of making fast forward to 100% like default behaviour of turbo progress bar.
After digging in turbo source code I came up with solution which fix this problem.
@gap777 it is on review queue I guess. All work regarding feature is done
@zhisme is this completed? Merged? What’s the status?