I tried to reset the value in text_input when a button is pressed. The value in the session_state is successfully reset. But the value displayed is not reset.
import streamlit as st
if st.session_state.get("reset", False):
del st.session_state["text"]
st.text_input(label="Text", key="text")
# del st.session_state["text_2"]
else:
st.text_input(label="Text", key="text")
st.write(st.session_state["text"])
st.button("Reset", key="reset")
Is this expected or is this bug to be fixed? Because the same behaviour doesn’t happen with number_input.
If this is expected, could anyone point out how to reset the displayed value?