Black Lives Matter. Please consider donating to Black Girls Code today.

dcc.Interval duplicate runs

It looks like the the interval input is being triggered twice every time.
I would expect it to only run once.
Also why is the first value of n_intervals non-zero?


import dash
import dash_core_components as dcc
import dash_html_components as html
import datetime as dt

app = dash.Dash()

app.layout = html.Div([
    dcc.Interval(id='my-interval', interval=5*1000, n_intervals=0),

    output=dash.dependencies.Output('display', 'children'),
    inputs=[dash.dependencies.Input('my-interval', 'n_intervals')])
def display_updae(n):
    print (f'n_intervals: {n} ... {str(}')
    return ""

if __name__ == '__main__':

hm that’s odd. do you happen to have multiple tabs open?

Yes, that was the problem. I had it open on another tab of a virtual desktop.
Thank you.

1 Like