dash
dash copied to clipboard
[BUG] Dropdown clears values on page refresh or tab switch when options are changed
Describe your context
python 3.10
dash 2.4.1 **2.3.1 does not show issue**
dash-bootstrap-components 1.1.0
dash-core-components 2.0.0
dash-daq 0.5.0
dash-html-components 2.0.0
dash-table 5.0.0
Describe the bug
Dash dcc dropdown persistence clearing all values when updating options even if returning no_update on value of dropdown
Expected behavior
dash multi selection dropdown should keep values that are still available if options are changed.
I want the inputs to be kept if a tab is changed to and back or on a page refresh (therefore i'm using persistence type local)
another page determines what dropdown options are available on original page
Screenshots
example dropdown setup
layout with a dropdown
dcc.Dropdown(
id='my-dropdown',
options=[],
value=None,
persistence=True,
persistence_type="local",
multi=True
),
@app.callback(
[Output("my-dropdown", "options"),
Output("my-dropdown", "value")],
Input("url", "pathname"),
[State("my-dropdown", "value")]
)
def load_dropdown(pathname, dropdown_values):
# some code here that determine what the dropdown options should be and if needed clear options that are no longer available
thanks for referencing this @alexcjohnson.
@T4rk1n - any chance you could take a look at fixing this too?
sorry didnt mean to close this
Is there an update on this issue?