Using st.rerun clears my chat_input from v1.35.0

I was using streamlit versions up till v1.33.0 for my applications. Recently, I had the requirement to use modal popups, and I was glad to see that streamlit has also released this feature from v1.34.0.

Reference: st.experimental_dialog - Streamlit Docs

However, when I downloaded v1.36.0 this month, I noticed that st.rerun() will clear what I typed in the st.chat_input. I have also tested on v1.35.0 and it has the same issue with chat_input. Only st.text_input() does not get cleared with st.rerun().

Steps to replicate this issue:

  1. Type something in the chat_input
  2. Click on the checkbox
import streamlit as st
ss = st.session_state

if "checked" not in ss:
    ss.checked = False
checked = st.checkbox("Check this checkbox after you have typed something")

if checked != ss.checked:
    ss.checked = checked
    st.rerun()

st.write(f"checked {ss.checked}")

user_message = st.chat_input("Type something, then click the checkbox")

You will see that the text written in chat_input gets cleared with st.rerun() in v1.35.0 and v1.36.0

Current solution:
To use dialog box and st.rerun with chat_input, only works in v1.34.0.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.