Hi,
I’m trying to create this dash app that takes two types of input in the callback:
- Input via input boxes
- Input via URL query params
Either way, whenever I try putting the input, it says the app is updating and then after that it shows only half the expected output.
However, whenever, I refresh the page again and re-enter the input, it displays the full output.
Note: After refreshing the page second time (after the input was provided), the second callback is called (via first callback) and then the correct/expected output is provided.
Ideally, as soon as the input is given, the first callback should be called (which is happening), however, the second callback is not called.
Now, if I refresh the page again, I get duplicate callback exception (in relation to second callback components, in which it says Output already in use).
Any clues why this is happening?
Any help would be appreciated as this is blocking my task.
Following is an example code corresponding with callbacks:
@app.callback(
Output("page-content", "children"),
[Input("url", "pathname"),
Input("submit-button", "n_clicks"),
State("input1", "value"),
State("input2", "value")],
prevent_initial_call=True)
def callback_function_1(pathname, n_clicks, val1, val2):
if pathname or n_clicks:
result = some_function() # [Note: this calls another function that contains the other callback]
return html.div(<some value based on result>)
def some_function():
<make some calls>
@app.callback(
Output(some_table_header, 'children'),
Input({'type': 'some-dropdown' , 'index': ALL}, 'value'))
def callback_function_2(values):
return some_list # [based on the values obtained]