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)?
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
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?