Please HELP! st.data_editor and st.forms behaves erratic!

Hello I’am truly desperate! And come here with little hope since I never got any help on my last post.
I am running a streamlit app on my local server so it can be accessed from my local network.

I need to add and edit some data so I decided to use the st.data_editor which worked fine for a while until I realized it was rerunning everything with each cell edit and running some SQL queries over and over again. So I decided to use data_editor inside a form as to get the values from the editor once the form was submitted and then process and do whatever I need to do with the data. How ever it only saves the data sometimes. I’ve tried using variables and session state to store the data to no avail.

Most of the time it works well every other time that is : click button works, click again fails, click again works, click again fails, … and so on.

Some times I have to press the button several times (more than 10) so it finally saves the data.

I’m currently trying to solve this using temp files (csv) to save the data and then load it to process it but its the same thing. It only saves the data to the csv file sometimes.

I’ve found some other people experiencing the same issue when using st.data_editor and st.form at the same time. But nobody has been able to solve it.

There seems to be something wrong in your code.