[BUG] Setting children to None leaves removed components registered: their callbacks keep firing and the subtree can never be mounted again
Mantenedores costumam responder em até 2 dias
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 62/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 24.4k
- Forks
- 2.3k
- Merge médio
- 2d 14h
- PRs com merge (30d)
- 23
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de plotly/dash
-
P2 plotly-internal size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias
-
Extract graph schema validation into properly named testTalvez já em andamento @Nice6042 assumiu há 57 dias. Abertagood first issue P3 size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
plotly/dash#3735 · 3 comentários ·
Mantenedores costumam responder em até 2 dias
-
[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapperTalvez já em andamento @KoolADE85 assumiu há 4 dias. Abertabug P2 size: 1
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
plotly/dash#4042 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
P3 plotly-internal size: 10+ task
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
plotly/dash#4040 · 3 comentários ·
Mantenedores costumam responder em até 2 dias
-
Drop Python 3.9 SupportAbertaP2 plotly-internal size: 5 task
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
plotly/dash#4038 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
Todas as issues de plotly/dash
Issues semelhantes
-
Performance: deprecated DeviceEntry.config_entries access blocks the event loop for tens of secondsAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
tuya/tuya_cloud_ha_bridge#14 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
semantica-agi/semantica#1968 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
agent: ready area: submission priority: high type: docs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
dkritarth/scopewatch#213 ·
Mantenedores costumam responder em até 1 dia
-
Broken link in RELEASE.mdTalvez já em andamento @Jah-yee assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
sphinx-contrib/httpdomain#143 ·
Mantenedores costumam responder em até 1 dia