Hi all,
Newbie question - did try searching the answer but nothing found…
I have a callback which is meant to be triggered by an Interval or change of Dropdown selection but I get too many callbacks where the callback_context indicates the dropdown has been triggered - even though I only changed it once?
e.g. I change the initial dropdown value of LLOY.L to VOD.L and I get the following:
{
"states": {},
"triggered": [],
"inputs": {
"my-dropdown.value": "LLOY.L",
"stream-update.n_intervals": null
}
}
{
"states": {},
"triggered": [
{
"prop_id": "stream-update.n_intervals",
"value": 1
}
],
"inputs": {
"my-dropdown.value": "LLOY.L",
"stream-update.n_intervals": 1
}
}
{
"states": {},
"triggered": [
{
"prop_id": "stream-update.n_intervals",
"value": 13
},
{
"prop_id": "my-dropdown.value",
"value": "VOD.L"
}
],
"inputs": {
"my-dropdown.value": "VOD.L",
"stream-update.n_intervals": 13
}
}
{
"states": {},
"triggered": [
{
"prop_id": "stream-update.n_intervals",
"value": 14
},
{
"prop_id": "my-dropdown.value",
"value": "VOD.L"
}
],
"inputs": {
"my-dropdown.value": "VOD.L",
"stream-update.n_intervals": 14
}
}
{
"states": {},
"triggered": [
{
"prop_id": "stream-update.n_intervals",
"value": 15
},
{
"prop_id": "my-dropdown.value",
"value": "VOD.L"
}
],
"inputs": {
"my-dropdown.value": "VOD.L",
"stream-update.n_intervals": 15
}
}
The interval is set to trigger every 500ms, so I expect to see plenty of those, but I only expect the dropdown to trigger when the user makes a change. But as you can see I get multiple triggered for the dropdown?
My definition for the dropdown is:
dcc.Dropdown(id='my-dropdown',
options=[{'label': i, 'value': i} for i in ric_list],
value=ric_list[0]),
and the interval one is
dcc.Interval(id='stream-update', interval=1 * 500),
Any ideas how I can limit the callbacks to only once each time the dropdown is changed?
Thanks