Hello,
I am developing a Streamlit app that can be opened via the page query parameter. To fully work with the page, you need to provide certain information as query parameters. This parameters I can extract as a dictionary and work with it, no problem.
However, I want to offer the user the possibility to modify the set query parameters and update/change them. This is not a problem, as I can use the “standard” Streamlit options for formulars.
The changes are reflected in a new dictionary and I can update the session_state.query_params dictionary.
However, as soon as the user clicks enter or outside of the modification field embedded in st.expander the page gets reloaded but the “old” query parameters are taking into account for loading. Not the modifyed one.
How can I change the code that the new parameters are taking into account and are updated in the browser URL query parameter?
Some code snipped for a clearer picture:
update_query_expander = st.expander('Modify query parameters', expanded=False)
update_query_1, update_query_2, update_query_3, update_query_4 = update_query_expander.columns(4)
....
st.session_state.query_parameter['env'] = update_query_1.text_input('Environment', value=st.session_state.query_parameter['env'])
st.session_state.query_parameter['signals'] = update_query_1.multiselect('Signals', default=st.session_state.query_parameter['signals'], options=signals)
st.session_state.query_parameter['start'] = update_query_1.number_input('Start', value=st.session_state.query_parameter['start'])
st.session_state.query_parameter['end'] = update_query_1.number_input('End', value=st.session_state.query_parameter['end'])
...
st.session_state.query_params.update(st.session_state.query_parameter)
All the best