Make the progress bar optional #124
Replies: 24 comments 20 replies
-
see PR #125 |
Beta Was this translation helpful? Give feedback.
-
I'm curious, why would you want to disable the progress bar for specific requests? This seem unnecessary...but maybe I'm missing something? |
Beta Was this translation helpful? Give feedback.
-
Closing this for now, because there hasn't been any other demand for this, and I don't really see the use-case myself. @francoisauclair911 Feel free to provide your reasons, and we can always revisit. |
Beta Was this translation helpful? Give feedback.
-
I actually think this is useful. |
Beta Was this translation helpful? Give feedback.
-
I kind of think the user should see a progress bar any time a request is occurring, and taking longer than the 250ms threshold, since with Inertia a synchronous page load is happening, and not just some "background" asynchronous xhr/fetch request that's clearing the notification. If you want the later behaviour, then I'm inclined to suggest just using xhr/fetch directly to do this, and not make an Inertia request. |
Beta Was this translation helpful? Give feedback.
-
Hi @anubra266, As of last month, the progress bar is an entirely separate package (https://github.com/inertiajs/progress) with a default (yet configurable) delay of 250ms. Since most simple requests finish between 60-120ms or so, we don't believe this should be a real issue for virtually anyone, unless they are on a very slow or unstable connection, in which case they might actually want to see a progress bar to indicate that something is happening. That said, we're more than open to being proven wrong, so if you think we're mistaken or are missing something, please let us know by commenting on this issue, and we'd be more than happy to consider the situation and re-open this issue! |
Beta Was this translation helpful? Give feedback.
-
Regarding this, I just feel it'll be great to have Inertia cover most cases, as some of us - including me have decided that Inertia is my Primary Stack for all projects. Having to use Inertia, and still fallback to the old way in all my projects seems unneccessary. Thanks @reinink |
Beta Was this translation helpful? Give feedback.
-
We get this more often, and I totally don't think this is the right way of looking at it. Rather, these are simply two different tools at your disposal. Use Inertia when making page visits, and use xhr/fetch when doing other asynchronous tasks. It doesn't have to be one or the other. Both tools have their place...and I use both in my Inertia apps! |
Beta Was this translation helpful? Give feedback.
-
And to be clear, I understand the not everyone has fast internet connections...which is arguably my point. Users should be aware that a slow request is still being sent...otherwise they could click on a different link and actually cause the "clear notification" request to get cancelled. |
Beta Was this translation helpful? Give feedback.
-
Thanks @reinink |
Beta Was this translation helpful? Give feedback.
-
Reopening this issue, because there is other demand for it (#310, #311), plus, I'm starting to see a use-case for this for lazily evaluated props, that are loaded "in the background". Inertia.reload({ only: ['something'], hideProgress: true }) |
Beta Was this translation helpful? Give feedback.
-
Oh thank you @reinink |
Beta Was this translation helpful? Give feedback.
-
To be clear though, all Inertia visits are still synchronous, so you can't use them for polling. See my comment here. If you want async behaviour, then you need to use xhr/fetch. |
Beta Was this translation helpful? Give feedback.
-
Ok... Understood |
Beta Was this translation helpful? Give feedback.
-
I'm guessing not support for:
|
Beta Was this translation helpful? Give feedback.
-
So, how can I do this nowadays? |
Beta Was this translation helpful? Give feedback.
-
@reinink i think we as developers should have a little opinions too Because right now am in need of such features for my Inertia.post method i don't need the progress bar showing Not everyone likes the whole progress bar everywhere for everyone requests you maybe see it as unnecessary but then interiajs was build for everyone so maybe giving us some flexibility won't be a bad idea Basically people use axios most times instead of the tools provided out of the box because of such little details Also on a side note implementing infinite scroll with interia manual visits is not visible because of some issues, so i use axios and it all works for just saying thou |
Beta Was this translation helpful? Give feedback.
-
Here is my case. On data entry, I don't want the user to have click a save button, so I am saving each field onBlur. But for the case where the user decides to leave the page or refresh without leaving the current field, I use the on window.onbeforeunload to blur the activeElement. This works about 70% of the time. But, sometimes the refresh takes place before the data is able to save, thus losing data. So, I am faced with saving onChange vs onBlur. In this case, it would be great to have the option showProgress: false Is there an alternative here that I haven't considered? |
Beta Was this translation helpful? Give feedback.
-
I ran into this today. My use case is that I have a search box that would fetch suggestions from the backend based on user initial input. Something like Google search box. I managed to build a component that work using Inertia reload to load only the suggestions but having problem stop the progress bar from showing. |
Beta Was this translation helpful? Give feedback.
-
Okay I am co-signing this. I'm using Inertia in The Boring JavaScript Stack heavily and my latest project seems to need this. I like the Inertia progress bar but my current implementation is saving the user editing their invoice on Hagfish as they type. Having to see a progress bar every time seems too much for that. For this case @reinink i think we can let the burden of the progress be on the developers sometimes. For my invoice editor I do show feedback "Saving...", "Saved!" I think that's enough feedback for the user. Also when I use Lemon Squeezy which use Inertia, their UI show progress bar for almost all navigation including closing modals which I think it's superfluous. I'd like to see this land in Inertia as I love this software and it's going to power how I build Fullstack JavaScript apps in The Boring JavaScript Stack |
Beta Was this translation helpful? Give feedback.
-
My use case for hiding the progress indicator is in a music player app. The external API i am using requires clients to poll an endpoint to see updated details like song names and cover arts for the now playing and history (previously played) sections. I'm rendering the page with inertia - which passes the songs list (as a prop) to my react component.. I know I can setup an xhr call for this, but that means i have to set up a new state object to update anytime i make an xhr call (since I can't be updating the songs list prop from inertia). Now this means the song list prop from inertia would also be out of sync with the new state variable I create. I'm not sure if it's a tedious task to hide the progress indicator but it'd be really easier for me if I could simply |
Beta Was this translation helpful? Give feedback.
-
Just submitted a PR for this #1842 Comments or upvotes on it might help get it merged |
Beta Was this translation helpful? Give feedback.
-
@reinink I need the progress bar disabled because I have a function that has to clear all window timeouts. I guess the progress bar runs on a setTimeout ID, and I have no way of avoiding clearing that ID because I have no access to the id. So when I clear all window timeouts, the progress bar gets stuck and breaks my app. I need an option to disable the progress bar OR a way to access the timeout id so as to not clear it in my clear all timeouts function. |
Beta Was this translation helpful? Give feedback.
-
I'm able to disable it in |
Beta Was this translation helpful? Give feedback.
-
Hi,
I know you guys are planing on adding more customization for the progress bar and I was wondering if it would be a good idea to make the progress bar optional on some requests
Proposition
Adding a
showProgress
props to the request and alsoinertia-link
componentThis props would be evaluated in the inertia.js and disable the progress bar if props is true
<inertia-link href="/posts" showProgress="false" method="post">Save</inertia-link>
Beta Was this translation helpful? Give feedback.
All reactions