Skip to content

[BUG] Using pattern matching ALL for running argument fails when the list is empty #3297

@logankopas

Description

@logankopas

When using pattern matching for the running argument (ex: running=[(Output({'type': 'loading', 'id': ALL}, 'display'), 'show', 'hide')]), if there are no components on the page dash throws the error: state.paths.objs[idKey] is undefined

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.4

Describe the bug

When using pattern matching for the running argument (ex: running=[(Output({'type': 'loading', 'id': ALL}, 'display'), 'show', 'hide')]), if there are no components on the page dash throws the error: state.paths.objs[idKey] is undefined

Expected behavior

No error, no side updates (since there are no components)

Minimum Working Example

import dash
from dash import Dash, html, dcc, callback, Output, Input, Patch, ALL, callback_context
import time
import random


app = Dash(use_pages=True, pages_folder="")

home_page_layout = html.Div([
    dcc.Loading(
        html.Div(id={'type':'scorecard', 'id': 'home1'}),
        id={'type': 'loading', 'id': 'home1'}
    ),
    dcc.Loading(
        html.Div(id={'type':'scorecard', 'id': 'home2'}),
        id={'type': 'loading', 'id': 'home2'}
    )
])
other_page_layout = html.Div('Other')

dash.register_page('home', path='/', layout=home_page_layout)
dash.register_page('blank', path='/blank', layout=other_page_layout)

app.layout = html.Div([
    dcc.Store(id='data'),
    html.H1(children='Title of Dash App', style={'textAlign':'center'}),
    html.Div([
        html.Span([
            dcc.Link(f"{page['name']} - {page['path']}", href=page["relative_path"]), ' | '
        ]) for page in dash.page_registry.values()
    ]),
    html.Button('Reload Data', id='reload-data'),
    dash.page_container
])


@callback(
    Output('data', 'data'),
    Input('reload-data', 'n_clicks'),
    prevent_initial_call=True,
    running=[(Output({'type': 'loading', 'id': ALL}, 'display'), 'show', 'hide')]
)
def get_data(n_clicks):
    time.sleep(3)
    return random.randint(0, 10)

@callback(
    Output({'type': 'scorecard', 'id': 'home1'}, 'children'),
    Input('data', 'data'),
    prevent_initial_call=True
)
def scorecard1(data):
    return f'Data: {data}'

@callback(
    Output({'type': 'scorecard', 'id': 'home2'}, 'children'),
    Input('data', 'data'),
    prevent_initial_call=True
)
def scorecard2(data):
    return f'Data squared: {data * data}'

if __name__ == '__main__':
    app.run(debug=True)

In this example, pressing the "Reload Data" button on the second page (/blank) throws the error as the loading elements are all on the first page

Activity

added
bugsomething broken
P2considered for next cycle
on May 8, 2025
fgoudreault

fgoudreault commented on Jul 31, 2025

@fgoudreault

Thanks for the report, I was playing around for the first time with pattern-matching callbacks in a running argument and didn't know where this cryptic error from dash clientside was coming from 😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2considered for next cyclebugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @gvwilson@logankopas@T4rk1n@fgoudreault

      Issue actions

        [BUG] Using pattern matching ALL for running argument fails when the list is empty · Issue #3297 · plotly/dash