Ok, so here is a weird one. I detected this behaviour in my app and was able to recreate this test case. Run the code below.
- Click on the balloons button → Balloons will fly
- Change the value of the selectbox → Balloons fly again.
Once the balloons fly, they always fly.
This behaviour does not happen with st.toast.
This behaviour is caused by the st.fragment decorator on the frag() function.
Remove it and behaviour is as expected
Question: Is this a bug?
import streamlit as st
@st.fragment
def frag() -> None:
st.selectbox("Please choose", options=["red", "yellow", "green"])
def balloons() -> None:
st.balloons()
def toast() -> None:
st.toast("Toast")
frag()
if st.button("Balloons"):
balloons()
# toast()
Tested with streamlit 1.41, 1.43 and 1.44