How to prevent app callback on page refresh

Hi I am trying to use callback function that updated my page layout every day. I am using Dcc.Interval and everything seems to work fine except when I refresh the page. When the page is refreshed the callback function is being called every time.
My code looks like this:

app.layout = html.Div(children=[


        interval=128*675000, # one day in millis (86400000ms)
    ], style={'padding': '35px 65px 20px 65px', 'background-color' : '#f9fbfd'})

    Output(component_id='dashboard', component_property='children'),
    [Input('interval-component', 'n_intervals')]
def update_graphs_live(n_intervals):

So I want the callback function to be called once a day…


Having the same issue. Did you find a way around it?

Maybe try prevent_initial_call=True inside your callback. This will make so that the callback does not run at first load

However your interval component will still be reset…

Hey did you find any new way? i want to update the data once every 12 hrs , but page reload messes it up.

This can be achieved with dcc.Store: Store | Dash for Python Documentation | Plotly

The example on the page shows the concept. Click all the buttons and then refresh the page. The local and session storage are kept. In your case, you could store the n_interval in local/session storage to persist it across page refreshs.