Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Callback_context returning both inputs as triggered when only one triggerer?

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

Hi @umernalla welcome to the forum! This is weird indeed. Would you be able to share here a minimal standalone app which would reproduce this behaviour? This would help understanding what’s going on.

Hi @Emmanuelle
Thanks for the reply and apologies for not getting back.
Unfortunately, my experiments with plotly have had to take a back seat due to some more urgent matter.
I will revert back once I have had time to create a simple example.

Hi @Emmanuelle
Sorry that I have not got back with this - but I have been too busy with work stuff.

I was just wondering - I am doing a Webinar for my employer this Thursday - during which I will be demonstrating how to consume and display streaming realtime market data + news in a Dash example (as well as Matplotlib and ipywidgets examples).
I was wondering if it would be appropriate to post an invite to the Webinar somewhere on this Plotly community page - in case others were interested. Hopefully, I will also be able to add the example to the Show & Tell section once the Webinar has taken place.
If it is OK to post an invite, can you advise the best place to do so? Thanks

PS We won’t be trying to sell anything to the attendees - the Webinar is aimed purely at our Developer community.