[BUG] Setting children to None leaves removed components registered: their callbacks keep firing and the subtree can never be mounted again
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 62/100
Piste de recherche
Start with the callback and component-removal path exercised by the toggle and update_view callbacks in the reproduction. Compare the lifecycle when children returns None with the working [] case, then verify that removed components stop generating requests and that mounting the view again restores it without a page reload.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary: if a callback removes a subtree by returning children=None, the removed components stay registered: callbacks targeting them keep firing, and the subtree can never be rendered again. Returning [] works correctly.
Describe your context
dash 4.4.1 (same on 4.5.0rc0, 4.0.0, 3.3.0, 2.18.2)
plotly 6.6.0
- Python 3.10, Windows 11, Microsoft Edge 154 (Chromium)
- Same with
debug=Trueanddebug=False, no error in the console or the dev tools
Describe the bug
from dash import Dash, Input, Output, ctx, dcc, html
app = Dash(__name__, suppress_callback_exceptions=True)
app.layout = html.Div([
dcc.Interval(id="tick", interval=1000),
html.Button("Mount", id="mount"),
html.Button("Unmount", id="unmount"),
html.Div(id="container"),
])
@app.callback(
Output("container", "children"),
Input("mount", "n_clicks"),
Input("unmount", "n_clicks"),
prevent_initial_call=True,
)
def toggle(_mount, _unmount):
if ctx.triggered_id == "mount":
return html.Div(id="view", children=html.Div(id="view-tick"))
return None # returning [] instead works as expected
@app.callback(Output("view-tick", "children"), Input("tick", "n_intervals"))
def update_view(n):
print(f"update_view called, n_intervals={n}", flush=True)
return f"tick {n}"
if __name__ == "__main__":
app.run(debug=False)
- Click Mount:
tick Nis displayed,update_viewruns every second. Correct. - Click Unmount: the text disappears, but the browser keeps sending
update_viewrequests every second (visible in the server log). - Click Mount again: the
togglerequest returns the subtree (HTTP 200), but#viewnever appears in the DOM, until the page is reloaded.
With return [] in toggle, step 2 sends no request and step 3 displays the view again.
Expected behavior
None and [] should both remove the subtree: no more callbacks for the removed components, and the subtree can be mounted again.
- Langage dominant
- Python
- Étoiles
- 24.4k
- Forks
- 2.3k
- Merge moyen
- 2 j 5 h
- PR mergées (30 j)
- 22
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de plotly/dash
-
P2 plotly-internal size: 1 task
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
Extract graph schema validation into properly named testPeut-être pris @Nice6042 l’a pris il y a 56 jours. Ouvertegood first issue P3 size: 1 task
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
plotly/dash#3735 · 3 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapperPeut-être pris @KoolADE85 l’a pris il y a 3 jours. Ouvertebug P2 size: 1
Difficulté 4/5 3-5 jours Accessibilité débutants 56/100
plotly/dash#4042 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Linter/Type Checking ReplacementOuverteP3 plotly-internal size: 10+ task
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
plotly/dash#4040 · 3 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
Drop Python 3.9 SupportOuverteP2 plotly-internal size: 5 task
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
plotly/dash#4038 · 2 commentaires ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de plotly/dash
Issues similaires
-
HTML: <template> content is extracted as document textPeut-être pris @ryanmeowy l’a pris aujourd’hui. Ouvertebug html
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
docling-project/docling#4714 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG] Qdrant RAG client applies score_threshold to raw cosine similarity, not the 0-1 score it returnsPeut-être pris @roydonsequeira l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
ashhart/TensorFold#536 ·
Les mainteneurs répondent en général sous 1 jour
-
area/install-update comp/cli duplicate P2 python:uv sweeper:risk-compatibility type/bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 62/100
NousResearch/hermes-agent#135440 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Deepak3699/Ai_Mentor#244 ·
Les mainteneurs répondent en général sous 1 jour