I’m running my app locally
I’m using python 3.12 and streamlit 1.29
Github: GitHub - Odrec/streamlit_deeplecture
My app loads a corpus to explore and manage. I generate neighborhoods of specific terms in the corpus and let the user edit those neighbors in the textarea and then they can save the neighbor back to the corpus so I added a button that the user can click when they want to replace the neighborhoods in the corpus with the edited ones. Everything was working fine until I added a tab because I want to add some coocurrences in a different tab as the corrections. Now when I click the button to update the corpus nothing happens and the website slightly blinks but then I click the button again and then it works. I was puzzled because it was working fine before but then I remembered I added the tab so I tried without the tab and it works on the first click but if the button is inside the tab it needs two clicks to work. My assumption is that the first click is being interpreted as me choosing the tab rather than clicking the button but this behavior is not intuitive since I can see all the tab content the moment I load the app. Any ideas how to solve this?
So more or less this is what happens
Works, no issue:
st.button(“Save changes in neighborhood”, disabled=st.session_state.disabled,
on_click=save_neighborhoods_file)
Doesn’t work on first click, but works on second click:
with tab1:
st.button(“Save changes in neighborhood”, disabled=st.session_state.disabled, on_click=save_neighborhoods_file)