hi! We’re having some trouble with buttons in tabs. Anytime a user clicks a button outside of a form, the page refreshes itself instead of executing the code. Here’s a paraphrased version of the code:
with tab1:
with st.form("test"):
...
if st.button("click"):
st.write("print")
While the form submission works fine, the button outside of the form reloads the page. Any ideas?
Hey @faisal.lalani, thanks for reporting this issue. Your issue might be related to a race condition we had with Streamlit version 1.9 & 1.10 that sometimes leads to the widget state being dropped and the page being refreshed. We fixed it in 1.11 (see this PR ). Is your app running with Streamlit 1.11?
that’s true In that case, this is unrelated and probably a new unknown issue. Unfortunately, I’m not able to reproduce it with the following code (deployed app):
import streamlit as st
tab1, tab2, tab3 = st.tabs(["tab1", "tab2", "tab3"])
with tab1:
with st.form("test"):
st.number_input("test")
st.form_submit_button("submit")
if st.button("click"):
st.write("print")
Do you have any code example that reproduces the issue?