emilhe / dash-extensions

The dash-extensions package is a collection of utility functions, syntax extensions, and Dash components that aim to improve the Dash development experience
https://www.dash-extensions.com/
MIT License
414 stars 58 forks source link

`running` in callbacks not working with blueprint pages: "Cannot read properties of undefined (reading 'concat')" #344

Open Maks1mS opened 1 month ago

Maks1mS commented 1 month ago
dash                 2.17.1
dash-core-components 2.0.0
dash-extensions      1.0.18
dash-html-components 2.0.0
dash-table           5.0.0

Sample Code:

import time
from dash_extensions.enrich import DashProxy, DashBlueprint, html, Input, Output, page_container

app = DashProxy(
    use_pages=True,
    pages_folder=""
)
app.layout = html.Div([
    page_container,
])

page1 = DashBlueprint()
page1.layout = html.Div([html.H2(f"Page1"), html.Button('Click me!', id='btn'), html.Div(id='log')])

@page1.callback(
    Output('log', 'children'), 
    Input('btn', 'n_clicks'),
    running=[(Output("btn", "disabled"), True, False)]
)
def on_click(n_clicks):
    time.sleep(2)
    return f"Hello world {n_clicks}!"

page1.register(app, "", prefix="")

app.run(debug=True)

When the callback is triggered, it produces the following error: Cannot read properties of undefined (reading 'concat').

image

Working code without dash-extensions:

import time
from dash import Dash, html, Input, Output, page_container, register_page

app = Dash(
    use_pages=True,
    pages_folder=""
)
app.layout = html.Div([
    page_container,
])

layout = html.Div([html.H2(f"Page1"), html.Button('Click me!', id='btn'), html.Div(id='log')])

@app.callback(
    Output('log', 'children'), 
    Input('btn', 'n_clicks'),
    running=[(Output("btn", "disabled"), True, False)]
)
def on_click(n_clicks):
    time.sleep(2)
    return f"Hello world {n_clicks}!"

register_page("home", path='/', layout=layout)

app.run(debug=True)