Skip to content

[BUG] dcc.Loading with children showing loading animation even when none of its children are updating #3276

Closed
@tlauli

Description

@tlauli

Describe your context
Please provide us your environment, so we can easily reproduce the issue.

  • replace the result of pip list | grep dash below
dash                                     3.0.3
dash_ag_grid                             31.3.1
dash_auth                                2.3.0
dash-bootstrap-components                2.0.1
  • if frontend related, tell us your Browser, Version and OS

    • OS: iOS
    • Browser chrome
    • Version 135.0.7049.85 (Official Build) (arm64)

Describe the bug

dcc.Loading with children is showing loading animation even though none of its children are updating

Expected behavior

the loading animation is shown if and only if any of its children are updating

MWE
In this mwe, the dcc.Loading shows its loading animation while the callback is running. Note that if the first "A" in layout is omitted, the loading animation is not shown.

from time import sleep

import dash_bootstrap_components as dbc
from dash import Dash, Input, Output, callback, dcc, html

layout = [
    "A",
    dcc.Loading(["A"]),
    "B",
    html.Div(),
    "C",
    html.Div(),
    html.Div(),
    "Date picker",
    dcc.DatePickerRange(),
    dbc.Tooltip(),
    html.Div(id={"app_name": "test", "component": "last-update-div"}),
    dcc.Interval(
        id={"app_name": "test", "component": "interval-refresh"},
        interval=1 * 1000,
    ),
]


@callback(
    Output({"app_name": "test", "component": "last-update-div"}, "children", allow_duplicate=True),
    Input({"app_name": "test", "component": "interval-refresh"}, "n_intervals"),
    prevent_initial_call=True,
)
def load_data(_):
    sleep(0.3)
    return "x"


app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = layout
app.run()

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokenregressionthis used to work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions