Adding new Pattern Matching components don't trigger their related callback
Aperta
@T4rk1n ci sta già lavorando.
Dal 28/2/2025.
bug
dash-3.0
P2
- Lingua principale
- Python
- Stelle
- 24.4k
- Fork
- 2.3k
- Merge medio
- 2g 7h
- PR unite (30g)
- 13
Descrizione
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!
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.