I have a selectbox with varying options, depending on a preceding selectbox.
However, when one changes a different option on the first selectbox, triggering a rerun, the second selectbox options do not update. Is that the intended functionality, even outside an st.form?
In addition, if the (not updated) second option isn’t included to the list of options of the other case, streamlit throws a silent error.
MWE included:
import streamlit as st
edit_section = st.selectbox('Section',
['A', 'B'],
index = 0,
key = 'edit_section')
max_position = {'A': 5, 'B': 1}[edit_section]
edit_position = st.selectbox('Position',
range(1, max_position + 1),
index = 0,
key = 'edit_position')
Steps to reproduce:
- Choose 5 as the position.
- Choose B as the section.