Skip to content
New issue

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

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

Already on GitHub? # to your account

Dropdown clears values on page refresh or tab switch when options are changed #2072

Open
brianleslie opened this issue May 31, 2022 · 3 comments
Labels
bug something broken P3 backlog

Comments

@brianleslie
Copy link

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
@alexcjohnson alexcjohnson mentioned this issue Jun 27, 2022
3 tasks
@brianleslie
Copy link
Author

thanks for referencing this @alexcjohnson.

@T4rk1n - any chance you could take a look at fixing this too?

@brianleslie
Copy link
Author

sorry didnt mean to close this

@brianleslie brianleslie reopened this Jul 21, 2022
@shayan09
Copy link

shayan09 commented Jun 2, 2023

Is there an update on this issue?

@gvwilson gvwilson self-assigned this Jul 25, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken labels Aug 13, 2024
@gvwilson gvwilson changed the title [BUG] Dropdown clears values on page refresh or tab switch when options are changed Dropdown clears values on page refresh or tab switch when options are changed Aug 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

3 participants