SelectBox/Radio: The index of the preselected option on first render

Hello @mneuh,

Perhaps widgets use some sort of caching. If you update one argument, the widget renders again.
I don’t know if it is the intended behavior though. I haven’t checked that internal part of streamlit, so I may be wrong.

Running this line is sufficient to illustrate the issue:

st.radio("Choose a number.", list(range(20)), random.randint(0, 19))

However, with some tweaking of the SessionState, I managed to fix the value rollback issue here by running the app twice on session state update: Multi-page app with session state.

In the demo, there is a use-case with radio and selectbox widgets.

I hope it helps!