I have a Dash app featuring a dcc.Graph in a dbc.Container (dbc for dash_bootstrap_components) which is updated every 2 min through dcc.Interval. I’d like users to be able to download the data in the chart. I tried to deliver this functionality using an html.Button and dcc.Download and it works (data downloaded upon button clicking) but I get an undesired behavior: every time layout is updated so is the data and that triggers that I get a file downloaded even if button is not clicked; instead, the download should only happen upon clicking the button.
The app consists of one callback that queries data and refreshes layout and outputs data to be downloaded; all based on (only) interval input. Then another callback allows data download by button clicking. To make the data available to the second callback, dcc.Store is used in first callback which outputs the data as JSON. Then the second callback has the button clicking and the data from the first callback as inputs.
I believe the issue that I’m getting is described in the following link (to note, I do have prevent_initial_call=True ), but cannot seem to find the solution for it…