Thank you for your response, @andfanilo!
My use-case is mainly for more intuitive UX. I have a form in which the submit button closes the expander around the form in order to show the results, all controlled by a variable in session state. (Note that, therefore, expanded
parameter is set to this variable). But since the variable is unaware of when the user interactively opens or closes the expander, if an event triggers a page re-run (like navigating between pages in a multi-page app), then the expander will use the state in the session, which may not be what the user had just opened the input to.
Also it’s great to hear the team is working on making streamlit stateful! I’ve been using the session state hack and while it does work pretty well, it’s been pretty janky at times.