Best layout practice when data loadings/processing takes time

Hello folks. I am new to Dash, but getting a feel for it. My question has to do with a specific styling question.

So I have a data table that allows the user to select a particular row for processing, then a button to trigger processing, and then a plot associated with the processing results. The processing time can take 10-20 seconds to generate results, during which time I am not sure what to represent on the GUI.

Once the button is pressed, does Plotly work better with say disabling the button–so it does not get pushed again until the current request is finished, or is it better to just open a Modal window to block the user from doing any interactions on the GUI is done, or is it better to show a Loading state, etc.

I find that some callbacks take longer to trigger than others, and I want to make sure that the GUI gets locked quickly–so the user does not start clicking things while the current request is processing. Otherwise, the user might inadvertently trigger another expensive call for processing and the GUI can inadvertently look clunky.

Does anyone have any styling suggestions on how to handle something like this.

Hello @krishnab,

Welcome to the community!

This is a good question.

First, I’d recommend using a background callback:

There are all sorts of things that you can do with the background callback, running configuration. You could even disable all the things that you labeled as expensive.

You could also display an alert or something that displays the progress of what is happening in the background, so that the user knows that it hasnt timed out or errored.

As a rule of thumb, if you would be uncomfortable when using the website and waiting, you should probably tell the user what is happening.

1 Like

Thanks @jinnyzor , I had not seen the Background callbacks info before, so that was very helpful. I will read through the details on how they work.

I am also just exploring the Loading and spinner components to see if they might work for some of this versus just disabling and re-enabling come controls at different times–depending upon processing status. But I can write some quick demos for that, to see which approach fits best.

Thanks for your help.

The loading spinners can be a bit unpredictable at times.

But you can use the background callback to also make them display too.

Good luck. :slight_smile: