plotly / plotly/dash

Lack of error message when a function is passed as an argument in a component in the initial layout

Open
#2,522 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context

  • pip list | grep dash below
dash                      2.9.3
dash-ag-grid              2.0.0a4
dash-bootstrap-components 1.4.0
dash-core-components      2.0.0
dash-design-kit           1.6.8
dash-enterprise-auth      0.0.5
dash-html-components      2.0.0
dash-iconify              0.1.2
dash-mantine-components   0.12.1
dash-snapshots            2.2.0
dash-table                5.0.0

Describe the bug

Passing a function as an argument (by mistake) causes an "Error Loading Layout" on the webpage with no description of the error.
example code:

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

app = dash.Dash()

def example_fun():
    return

server = app.server
app.layout = html.Div([dcc.Graph(figure=example_fun)])    # should be example_fun()

if __name__ == "__main__":
    app.run_server(debug=True, port=8050)

Expected behavior

There should be a more descriptive error message such as "functions not supported as arguments"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied Dash app with figure=example_fun rather than example_fun(), then trace the layout-loading error path. Confirm that the browser receives a descriptive message for function-valued component arguments, and verify the corrected behavior with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.