-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Global Loading Indicator #879
Comments
I like this idea, in fact I've implemented very similar functionality in apps prior to dash. Should be fairly straightforward. Thanks for the suggestion @orenbenkiki! |
Note that we have a CSS-only version of this available right now - We inject a
into the app whenever it is waiting for a callback to be executed. This element is unstyled and contains no content. You can bind your own loading screens to this component by using custom CSS. See some examples & discussion here: https://community.plot.ly/t/dash-loading-states/5687 This could definitely be improved a variety of ways:
|
I didn't know about I immediately put it to good use and now have a nice floating CSS spinner roughly placed in the middle of the area where my graphs go (using Thanks! |
closed by #2760 |
Is your feature request related to a problem? Please describe.
This relates to #869.
In general
Loading
requires the cooperation of each wrapped component. This places a burden on component writers (e.g.,DataTable
) to explicitly provide support forLoading
.Also, in a single page, there may be multiple
Loading
components. Replacing each with a spinner is a jarring UI, especially when the spinner size is not compatible with that of the component it is replacing.Describe the solution you'd like
Create a new component with a global
is_loading
property. That is, this property isTrue
if there is any pending request to the back-end for fresh data. Only when all such requests have been served wouldis_loading
becomeFalse
.This allows the page designer to have a single loading indicator on the page (e.g., a global semi-transparent spinner
div
covering the whole page, or a red/green indicator somewhere, etc.).The tricky part is that
is_loading
must not be affected by any callbacks that are triggered by changes tois_loading
itself. Specifically, whenever any update triggers a request to the back-end, ifis_loading
isFalse
, thenis_loading
needs to be changed toTrue
, and any callbacks listening onis_loading
need to be invoked first, followed by the original request.When a request is complete, if it is the last pending request and
is_loading
isTrue
, thenis_loading
needs to be changed toFalse
. Any callbacks listening onis_loading
need to be invoked. These callbacks must be completed before any new requests are sent.For sanity, if a callback listens on
is_loading
, it is an error for any of its outputs to trigger any further callbacks. For simplicity, a callback onis_loading
might also be prevented from having any other inputs. This would eliminate all sort of "interesting" edge cases in the code and still allow for the intended use cases.The text was updated successfully, but these errors were encountered: