Tristan Thrush commited on
Commit
a081a7c
1 Parent(s): 1a787c7

fix for double dataset select bug

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -141,10 +141,13 @@ st.markdown(
141
 
142
  all_datasets = [d.id for d in list_datasets()]
143
  query_params = st.experimental_get_query_params()
 
 
 
144
  default_dataset = all_datasets[0]
145
- if "dataset" in query_params:
146
- if len(query_params["dataset"]) > 0 and query_params["dataset"][0] in all_datasets:
147
- default_dataset = query_params["dataset"][0]
148
 
149
  selected_dataset = st.selectbox(
150
  "Select a dataset",
 
141
 
142
  all_datasets = [d.id for d in list_datasets()]
143
  query_params = st.experimental_get_query_params()
144
+ if "first_query_params" not in st.session_state:
145
+ st.session_state.first_query_params = query_params
146
+ first_query_params = st.session_state.first_query_params
147
  default_dataset = all_datasets[0]
148
+ if "dataset" in first_query_params:
149
+ if len(first_query_params["dataset"]) > 0 and first_query_params["dataset"][0] in all_datasets:
150
+ default_dataset = first_query_params["dataset"][0]
151
 
152
  selected_dataset = st.selectbox(
153
  "Select a dataset",