Change in behavior for selectbox in v1.34.0

Hi,

v1.34.0 changes the behavior of the selectbox widget. Here is our widget:

st.selectbox(
    "QUERY",
    key=query_selection_key,
    options=st.session_state[query_select_options_key],
    help=st.session_state.q_select_tooltip,
    index=st.session_state[query_selection_index_key],
    on_change=self._callbacks.q_selection_changed,
)

In our app, we use the index argument to set the initial state. We have verified it works on all versions pre-v1.34.0. Here is how the widget lookson v1.34.0, when the index argument is set to 0.

image

Here are the v1.34.0 widget variables state:

(Pdb) st.session_state[query_selection_key]
(Pdb) st.session_state[query_selection_index_key]
0
(Pdb) st.session_state[query_select_options_key]
['WS1_BinData']

Here is v1.33.0:

(Pdb) st.session_state[query_selection_key]
'WS1_BinData'
(Pdb) st.session_state[query_selection_index_key]
0
(Pdb) st.session_state[query_select_options_key]
['WS1_BinData']

On v1.34.0 the selectbox session state value is None, on v1.33.0 it is set to ‘WS1_BinData’. I don’t see any changes in the v1.34.0 release notes that look to be the cause. Looks like an escape in your unit testing or an undocumented change in behavior.

thx

Cannot reproduce.

Screenshot 2024-05-09 at 15-25-19 test · Streamlit

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.