Hi I encountered a bug where the form submission is inconsistent
to reproduce it check the following:
import streamlit as st
@st.cache(allow_output_mutation=True)
def storedVars(session):
return {'a':''}
var=storedVars(0)
newVar=''
with st.form("my_form"):
newVar=st.text_input('',value=var['a'])
if st.form_submit_button("Execute"):
var.update({'a':newVar})
st.write(newVar,var)
Try to enter a new value to the form and press ‘Execute’,
You can see that the new value you inputted is only submitted to the var ‘newVar’ once in every 2 times.
i.e.
fill in the form with 1, press Execute, you get result of 1 and 1
Then,
fill in the form with 2, press Execute, you still get result 1 and 1,
fill in the form with 2 again, press Execute, you now get result 2 and 2,