New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
st.chat_input() not resetting to None
after script rerun
#7629
Comments
The same with a simple conditionnal button scenario. Even the example code from the doc doesn't work anymore for egg : import streamlit as st
if "value" not in st.session_state:
st.session_state.value = "Title"
st.header(st.session_state.value)
if st.button("Foo"):
st.session_state.value = "Foo"
st.rerun() The on_click fallback seems not affected. This code doesn't provoke any infinite loops : import streamlit as st
if "value" not in st.session_state:
st.session_state.value = "Title"
st.header(st.session_state.value)
def callback_fn():
st.session_state.value = "Foo"
st.rerun()
st.button("Foo", on_click=callback_fn) |
I think I know the cause. As part of session state yield points, I allowed triggers to no longer be reset if the script run was interrupted by a rerun exception, to bring it in line with the behavior of fast reruns. But I neglected to account for |
Closing this issue as this was addressed by #7643. We'll have the changes released in a patch release tomorrow or Friday |
Checklist
Summary
Hi guys,
Since
streamlit>=1.28.0
, there is unexpected behaviour in my streamlit chat app. I have looked at the 1.28.0 commits but haven't spotted anything... The new version seems to not reset the output ofst.chat_input()
after rerunning the app withst.rerun()
orst.experimentatl_rerun()
. This causes anRecursionError: maximum recursion depth exceeded while calling a Python object
in the app. See code below.Reproducible Code Example
Steps To Reproduce
Expected Behavior
After the
st.rerun()
, I expect the script to rerun, resetting thest.chat_input()
and therefore makingprompt = None
.Current Behavior
After the
st.rerun()
, there is an infinite loop, making an error:Is this a regression?
Debug info
Additional Information
--> Additional info into why I'm using st.rerun() in this context:
I maintain the streamlit-feedback component, which requires the use of
st.rerun()
to load the most recent feedback component for a chat message. An example of this implementation can be seen here.The text was updated successfully, but these errors were encountered: