Adding new Pattern Matching components don't trigger their related callback
Offen
@T4rk1n arbeitet bereits daran.
Seit 28.2.2025.
bug
dash-3.0
P2
- Vorherrschende Sprache
- Python
- Sterne
- 24.4k
- Forks
- 2.3k
- Ø Merge
- 2 T. 7 Std.
- Gemergte PRs (30 T.)
- 13
Beschreibung
Describe your context
dash 3.0.0rc3, 3.0.0rc2, 3.0.0rc1, 2.8.12
- not front end related
Describe the bug
Pattern matching callback that should be triggered as soon as a related component is present in the layout just fire the first time the page is loaded. New components that get add by the callback itself should trigger the callback again but those trigger don't happen.
MRE
# app.py
from dash import Dash, html, page_container, dcc, callback, MATCH, Input, Output
from pages.components import LacyContainer
import time
app = Dash(__name__, use_pages=True)
col_style = {
"display": "flex",
"flexDirection": "column",
"gap": "2rem",
}
row_style = {
"display": "flex",
"flexDirection": "row",
"gap": "4rem",
"margin": "2rem"
}
app.layout = html.Div(
style=row_style,
children=[
html.Div(
style=col_style,
children=[
dcc.Link("Page - 1", href="/page-1"),
dcc.Link("Page - 2", href="/page-2"),
]
),
html.Div(page_container),
],
)
@callback(
Output(LacyContainer.ids.container(MATCH), "children"),
Input(LacyContainer.ids.container(MATCH), "id")
)
def load_lacy(lacy_id):
time.sleep(1.3)
lacy_index = lacy_id.get('index')
children = (
html.Div(
children=[
html.Div(lacy_index),
LacyContainer(dcc.Loading(display="show"), index=3),
],
style=col_style
)
if lacy_index < 4 else
html.Div(
lacy_index
)
)
return children
if __name__ == "__main__":
app.run(debug=True, port=3000)
# pages/page1.py
from dash import dcc, register_page
from .components import LacyContainer
register_page(__name__, path="/page-1")
def layout(**kwargs):
return LacyContainer(dcc.Loading(display="show"), index=1)
# pages/page2.py
from dash import dcc, register_page
from .components import LacyContainer
register_page(__name__, path="/page-2")
def layout(**kwargs):
return LacyContainer(dcc.Loading(display="show"), index=2)
# components.py
from dash import html
class LacyContainer(html.Div):
class ids:
container = lambda idx: {"index": idx, "type": "lacy-container"}
def __init__(self, children, index, **kwargs):
super().__init__(children, id=self.ids.container(index), **kwargs)
Expected behavior
The expected behaviour would be:
- Page is loaded and contains multiple "lacy components" with a dict ID
- lacy component trigger the callback
- callback itself returns new "lacy components" which trigger the callback again up to the point, no more lacy component is present in the layout
Screenshots

The dots underitems should trigger the callback and should be replaced, but this never happens.
Thanks in advance and many thanks for your great work!
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.