plotly / plotly/dash

[BUG] callback not triggered when input changes in some configurations

Open
#3,285 1 comment 0 reactions 1 assignee View on GitHub

@T4rk1n is already working on this.

Since Apr 22, 2025.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

context

dash                 2.18.2
dash-core-components 1.7.1
dash-html-components 2.0.0
dash-renderer        2.0.0
dash-table           5.0.0

Description

The problem I have can be reproduced running the following app:

from time import sleep

import dash
from dash import callback, dcc, html, Output, Input, State

app = dash.Dash(__name__, serve_locally=False)


app.layout = html.Div(
    [
        html.Div("orig",id="display"),
        dcc.Input(id='input', value='Initial Value', type='text'),
        html.Button('Submit', id='submit-btn', n_clicks=0),
        dcc.Store(id="store-1"),
        dcc.Store(id="store-2"),
    ]
)
app.enable_dev_tools(debug=True)
server = app.server

@callback(
    Output("display", "children"),
    Input("store-1", "data"),
    Input("store-2", "data"),
prevent_initial_call=True,
)
def display(store1, store2):
    print(f"display triggered, input ({store1}, {store2})")
    return f"store1: {store1}, store2: {store2}"

@callback(
    Output("store-1", "data"),
    Input("submit-btn", "n_clicks"),
    State("input", "value"),
prevent_initial_call=True,
)
def submit(_, text):
    return text

@callback(
    Output("store-1", "data",allow_duplicate=True),
    Output("store-2", "data"),
    Input("store-1", "data"),
prevent_initial_call=True,
)
def process(text):
    print("process triggered")
    sleep(3)
    print("process ended")
    return (f"processed1-{text}", f"processed2-{text}")

Actual behavior

When I click on the button, I get:
submit callback is triggered -> store-1 modified -> onlyprocess callback is triggered -> eventually process finishes -> store-1 and store-2 modified -> display is triggered

and in the logs I see:

process triggered
process ended
display triggered, input (processed1-Initial Value, processed2-Initial Value)

The first store-1 change should have triggered the display callback directly.

Expected behavior

When I click on the button:
submit callback is triggered -> store-1 modified -> both process and display callback should be triggered at the same time -> eventually process finishes -> store-1 and store-2 modified -> display is triggered

i.e. I should have seen in the logs:

process triggered
display triggered, input (Initial Value, None)
process ended
display triggered, input (processed1-Initial Value, processed2-Initial Value)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.