Same thing here.
My app works perfect in local, but when deployed to google cloud it refreshes automatically every 1.5 to 5 minutes randomly.
This refresh deletes all the things done or selected by the user, which i think is a serious bug.
Looks like it happens in streamlit cloud and google cloud, so not a one cloud system issue.
I have try a couple of workarounds but none of them worked.
a) first workaround, set this in the config.toml file
[server]
runOnSave = true
b) second workaround: set a ping to a random server at the end of my code, with a sleep time of 5 sec. this way the app is always active and you can make sure of it as the running icons on the top right corner are moving. But didn´t work.
Also thought this could be a browser issue (browsers auto refresh tabs normally), so I took a tab in chrome to run the app, and disabled the auto refresh options of the browser. But didn´t work either.
There is another discussion with the same topic here: