Why can an output only have a single callback function?

So does this mean that support for it might get released sometime in the (unknown) future or is there are concrete roadmap for when this will work?

There more I think about this, the more I dislike this restriction, since I already found situations where more than one output would need to get updated by more than one callback handler.
Which basically means that almost all processing has to be done in one huge callback which always receives all data and always has to decide what to use, hand over to some actual processing function and finally which output to actually update.
Which in my view renders the whole Input/Output declaration option useless except in the most simplistic situations.

But maybe I see it like this because Dash is not actually meant for the kind of GUI interaction I have in mind and I am trying to abuse the wrong tool for my purposes. Sorry … I am currently at a stage where I try to figure that out :slight_smile:

This is definitely a downside to its current state.

However, coming from a flask / javascript background myself, there are many ways to attain the level of interaction I think we are used to.

One of the ways is to use Pattern-Matching, which gives tons of customization and flexibility.

Another way is to use Dash-Extensions.


Another thing you can do, through JS is manipulate the element if necessary and then have a sync function which syncs with the server and React components.

1 Like

I would recommend the MultiplexerTransform from dash-extensions for now. When/if a native solution becomes available, you’ll only need to change a single line of code.

1 Like

Thanks, I had a quick look at that extension and it looked like something I had already been wondering about whether it could be done that way: have several callbacks all send to a Store (and in addition to output exclusive to them directly) and then have the Store all send to the shared output(s).

Doing this explicitly like that may actually make it possible to prevent at least some of the unnecessary couplings, if I understand correctly (still pretty much in the plan-it-in-my-head phase right now).

Yes, it is possible to do it manually. I did that for a few simple cases :smile: . But it is a lot simpler to auto generate the code, which dash-extensions can do for you. It will also make your code more readable/maintainable, and when/if Plotly are ready with a solution, you won’t have to do extensive refactoring.

1 Like