I have a dash with dozens of expanders. Only a few expanders have an upload button in them. When those are expanded, the entire app reloads. The other expanders do not behave this way.
... with st.expander(exp_label, expanded=False): ... if data['upload_option'] == True : uploaded_file = st.file_uploader("Upload a new file:", type=['csv','xls','xlsx'], key=this_key+"_upload") if uploaded_file is not None: [do stuff]
Only some expanders have this upload option, as the
upload_option is only true for maybe 5-6 expanders.
The other expanders open and close with no problem.
The expanders with the upload option immediately invoke a reload of the whole app, almost as if
st.rerun() was called (it is not, though).
Further, once the app reload is complete, I can open and close the expander as many times as I want and it does not invoke an app reload.
No reload when expander is expanded.
This behavior is consistent between my local run (Win 11, run via
streamlit run myfile.py) and the Streamlit cloud deployment.