Couldn't use Selectbox to select item, with Session State


This is my first time here. Previously, I had issues when my selecting an item in the selectbox refreshed the app and the select box would only select the default value. I solved that issue using the gist.

I’m having a similar issue here. However, even when I use st.session_state, selecting value tend to refresh the app, at selectbox is only having the default value.

Some details:

At the start of my code, I have a bunch of data fetch from dbs, which I assign to st.session_state as dataframes. Based on these data, I make a list for selecting rows in the dataframes. Until here everything is fine.

Have a radio box, based on user inputs, I further subselect the dataframes using a second st.selectbox. This is where it is going wrong, the app refreshes and default value is the one that is selected.

The dataframes are huge. The lists used in the selectboxes are long.

  • I don’t understand, why one selectbox should work fine when the other doesn’t?
  • Is this a known issue?
  • Is there a work around?

Please let me know if you need anyother details