Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ndrezn opened this issue Sep 5, 2024 · 4 comments · Fixed by #2987
Closed

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

ndrezn opened this issue Sep 5, 2024 · 4 comments · Fixed by #2987
Assignees
Labels
bug something broken P1 needed for current cycle regression this used to work

Comments

@ndrezn
Copy link
Member

ndrezn commented Sep 5, 2024

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

@ndrezn ndrezn added the bug something broken label Sep 5, 2024
@T4rk1n T4rk1n self-assigned this Sep 5, 2024
@gvwilson gvwilson added regression this used to work P1 needed for current cycle labels Sep 5, 2024
@johnkangw
Copy link

@ndrezn Thanks for fixing this! I was wondering why in our apps we were receiving errors for this component.

@leo-smi
Copy link

leo-smi commented Sep 13, 2024

@ndrezn Thanks for fixing this! I was wondering why in our apps we were receiving errors for this component.

Does this replace the old sintax "PreventUpdate"?

@ndrezn
Copy link
Member Author

ndrezn commented Sep 17, 2024

@leo-smi no, no relation to PreventUpdate.

@leo-smi
Copy link

leo-smi commented Sep 17, 2024

@leo-smi no, no relation to PreventUpdate.

Thank you. Saw here that one is only for one output and other for all outputs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P1 needed for current cycle regression this used to work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants