Radio button UI and session state value not synchronised

Hi all,

first time posting so sorry if I’m not doing the correct way.
I’ve seen this old post because I was experiencing something similar:

You can see the issue here in the playground: Playground • Streamlit
Basically everything works fine until I press the button and st.rerun() is triggered. After that, the value is set to the default one, but the UI stays on the previous selection:

Can you explain me why? How to eventually solve this?
Am I missing something?

Thanks,

Michele

I think it is a but and I vaguely remember seeing it reported in github, but I can’t find the report right now.

The example can be fixed by just not calling rerun(), since clicking the button will rerun the app anyway. Your actual use case may require something different, though.