Skip to content

[REGRESSION] Number of no_output must match number of outputs in dash==2.18.0 #2986

Closed
@ndrezn

Description

@ndrezn

In dash==2.18.0, the number of no_update returned must match the number of outputs. This is not true in earlier versions of Dash.

This can be resolved by making no_update match but is a regression.

Consider:

import dash
from dash import html, dcc, Input, Output, no_update

# Initialize the Dash app
app = dash.Dash(__name__)

# Define the layout
app.layout = html.Div(
    [
        dcc.Input(id="input-box", type="text", value=""),
        html.Button("Submit", id="button"),
        html.Div(id="output-1", children="Output 1 will be displayed here"),
        html.Div(id="output-2", children="Output 2 will be displayed here"),
    ]
)


# Callback with two outputs
@app.callback(
    Output("output-1", "children"),
    Output("output-2", "children"),
    Input("button", "n_clicks"),
    Input("input-box", "value"),
)
def update_outputs(n_clicks, value):
    if n_clicks is None:
        return no_update
    return "Hello", "world!"


# Run the app
if __name__ == "__main__":
    app.run_server(debug=True)

Dash 2.18
Screenshot 2024-09-05 at 1 37 26 PM

Dash 2.17
Screenshot 2024-09-05 at 1 37 44 PM

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