As per Force Reload of Webpage, I’m trying to refresh/reload my page calling the snippet after st.button():
streamlit_js_eval(js_expressions="parent.window.location.reload()"). However, it fails to do so and all of my previous my session_state + widget inputs still remain. I could’ve sworn this worked when I first tried it out, but I’m not sure if its because of the version of streamlit (v1.26.0) and streamlit-js-eval (0.1.5) I’m using in my environment.
Hi @pr00001, st.rerun should do instead, provided your page is in a function.
Oddly enough, the session_state variables don’t clear even after using st.rerun
That is expected.
st.rerun does programatically the same than selecting “Rerun” in the hamburger menu, it reruns the script within the same session. Indeed very different from the browser reloading the page, that starts a new session. For that you do need JS.
Unfortunately I don’t know how to fix yous JS issue.