I am wondering what to do to deal with a series of callbacks that tend to lock up my app.
I have a series of figures that are all tied to some selection of datasets. I plot all the figures with a plot
button, as shown this post.
As I was developing this app, I noticed that there is no “debounce” method on the button clicks. So if my figures take a long time to load, and the user starts clicking on the plot
button, then my app is hosed.
So, my first question is: Is there a clean way to “debounce” the buttons that are tied to figure callbacks?
To mitigate the multiple clicks effect, I have another callback to my plot
button itself which sets the disabled
property of the button. This is to prevent the user from repeatedly clicking on the plot button.
I have made a plugin (such and awesome feature of Dash!!) for a React component that serves as a data selector. It has an isDirty
property that gets set with each data selection, and gets cleared on plotting. This does work, except for the fact that the disable_plot_button
callback does not fire until after all of the figures have been updated. In other words, the user is still able to shoot himself in the foot while he is waiting for the plots to load.
So my second question is: How can we determine, and modify, the order in which the callbacks are executed? If I can’t have a debouncer on the button, then giving my disable_plot_button
callback the highest priority would work.