Possible bug in dcc.Dropdown

thanks to help from @chriddyp I have had a function replicating the Dynamic Options example on dcc.Dropdown | Dash for Python Documentation | Plotly working for some time to return front matches only. I wanted to improve this function to add some additional matches and have struggled with getting them to appear.

To lay out the basics, my dcc.Dropdown is defined as:

dcc.Dropdown(id=f"ddm_syms-portfolio_beta",
                            multi=True,
                            clearable=False,
                            persistence=True,
                            persistence_type='session',
                            placeholder='Enter one or more stocks')

and my callback is defined as:

@app.callback(
    dash.dependencies.Output("ddm_syms-portfolio_beta", "options"),
    [dash.dependencies.Input("ddm_syms-portfolio_beta", "search_value"),
     dash.dependencies.Input("ddm_syms-portfolio_beta", "value")]
)
def update_sym_options_portfolio_beta(search, value):
    # code finding matches 
    r = [{'label': m, 'value': m} for m in matches + value]
    print(f'r={r}')
    return r

So then I add dummy [‘AAA’, ‘ZZZ’, ‘FOO’] to my matches. When I put my cursor into the dropdown, the dummy values are returned and are visible:

r=[{'label': 'AAA', 'value': 'AAA'}, {'label': 'ZZZ', 'value': 'ZZZ'}, {'label': 'FOO', 'value': 'FOO'}]

Screen Shot 2020-12-12 at 2.40.41 PM

However when I type anything in the dropdown, my normal matches appear as options but the dummy values are gone, despite the print statement showing them as returned along with the matches:

r=[{'label': 'DDD', 'value': 'DDD'}, {'label': 'AAA', 'value': 'AAA'}, {'label': 'ZZZ', 'value': 'ZZZ'}, {'label': 'FOO', 'value': 'FOO'}]

Screen Shot 2020-12-12 at 2.43.19 PM

and when I type ‘zz’ I get just one of my dummy options even though all three are returned:

r=[{'label': 'AAA', 'value': 'AAA'}, {'label': 'ZZZ', 'value': 'ZZZ'}, {'label': 'FOO', 'value': 'FOO'}]

Screen Shot 2020-12-12 at 3.15.00 PM

So it appears dcc.Dropdown is still doing a layer of filtering on it’s own despite me not wanting that. Is there any setting I can make to turn that off?

1 Like