How to use raise PreventUpdate in multiple outputs

Hi, I have a long callback with multiple outputs (for certain reasons, this is more efficient than multiple single output callbacks). I would like to use raise PreventUpdate for some of the outputs. How can I do this? Thanks.


You can’t currently, you need to take the current state of the props and return that state when you return the outputs. E.g.

    output=[dash.dependencies.Output('foo1', 'bar1'),
            dash.dependencies.Output('foo2', 'bar2')],
    inputs=[dash.dependencies.Input('input-trigger', 'value')],
    state=[dash.dependencies.State('foo1', 'bar1'),
           dash.dependencies.State('foo2', 'bar2')],
def some_function(input_trigger, foo1, foo2):
    if some_condition:
        return some_new_value, foo2
    if some_other_condition:
        return foo1, some_other_new_value
    return some_new_value, some_other_new_value

However if you’re willing to wait, I believe this partial no update feature is coming in the next version of Dash: Partial updates by alexcjohnson · Pull Request #680 · plotly/dash · GitHub

1 Like

Wow great! That is going to make a big difference to the performance of my app I believe- since those output functions are triggering so many unnecessary callbacks. Thank you @Damian