How to make specific input not trigger a callback

I have an app that looks like

app.layout = html.Div([
html.Dropdown(id=‘dd_1’, …
html.Dropdown(id=‘dd_2’, …
html.Div(id=‘data_store’, …
html.Div(id=‘graphs’, …
… other dependent htmls

Trying to use the datastroing recommended here

Drop downs one and two will both trigger a change in the data stored. I only want to update graphs when dropdown 2 changes (as it will require further calculations. However, since ti requires the data in data_store, it has to be dependent, so when dropdown 1 updates, the data updates, and the graphs will update as well.
Is there a way to prevent a certain input to trigger an update (but be available as argument if the other input triggers)?

Hi @ziczac, not sure if this might help, but have you looked into State?

I think I understand your question:

  • callback 1: Output('data_store', 'children'), and [Input('dd_1', 'value'), Input('dd_2', 'value')]
  • callback 2: Output('graphs', 'children') with [Input('data_store', 'children')]

One way to approach this problem is to have an intermediate div that is updated after callback 1.

  • Intermediate div will persist a json blob containing the dropdown states. When a dropdown is updated (value != json blob), you’ll be able to tell which dd was last toggled. You can use something like epoch time of last change to flag the latest.
  • Intermediate div is the new input to the callback for ‘graphs’ and loads data_store as state.
  • In the callback, check for which dropdown was toggled. If it is the dropdown which you DON’T want to update the figure, you can raise the PreventUpdate dash exception. from dash.exceptions import PreventUpdate

Thanks, looking at that descriptions, that is what I was looking for

So, the problem with the state is that it doesnt create a dependency, it seems, so it doesnt seem guaranteed that data has been updated

@brad, so you mean that I should keep track of previous states in the data_store itself. Than can work

It should always have the latest value of the data. If it doesn’t, then that’s a bug. Could you create a simple, reproducable example that demonstrates this?