Skip to content

[BUG] Dash DCC.Dropdown using Dynamic Options, nested within dcc.Loading returns empty list #2422

@urifeigin

Description

@urifeigin
dash                      2.7.1
dash-ag-grid              0.0.1
dash-bootstrap-components 1.3.0
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0
- OS: Windows 11
- Browser: Edge
- Version 110.0.1587.41 

Describe the bug

Using Dash DCC.Dropdown using Dynamic Options, nested within dcc.Loading returns empty list.

Upon inspection the callback fires twice, once retuning the options list for the dropdown as expected and once returns and empty list even though prevent update is used. This happens on any single key pressed in the search box of the dropdown. removing the DCC.Dropdown from being nested in dcc.loading resolves the issue.

The code example used is exactly as in the dash documentation, except for the dcc.loading wrapper.

                                                        dcc.Loading(
                                                            [
                                                                dcc.Dropdown(
                                                                    id="add_new_wave_modal_entity_sel_id",
                                                                ),
                                                            ]
                                                        ),

@callback(
Output("add_new_wave_modal_entity_sel_id", "options"),
Input("add_new_wave_modal_entity_sel_id", "search_value"),
)
def update_options(search_value):
if not search_value:
raise PreventUpdate
return [o for o in glb.wave_entity_signals_dd_options if search_value in o["label"]]

Expected behavior

The dcc.dropdown list will populate according to the typed filter on the fly. the spinner of the dcc.loading will appear if the list takes time to appear.

Screenshots
Screenshot 2023-02-13 020120

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions