I have created a Streamlit app for PDF information extraction. It has 7 pages (7 py files saved in /pages folder). The issue is that on switching between pages from the sidebar, the progress in the previous page is lost.
Steps to reproduce
You can find this by checking this app from the Streamlit App Gallery
Zoom into the map in the draw support page
Select any other page
Return back to the draw support page
Expected behavior:
The map is still zoomed in
Actual behavior:
Progress/operations (here zooming into the map) done in the page is gone. The page is refreshed.
Debug info
Streamlit version: 1.22.0
Python version: 3.9
Additional information
One solution is changing from multiple pages to multiple tabs in a single page (st.tabs). Since there is a lot going on each page, converting them to tabs caused delay in loading.
Typically, a Streamlit app runs from top to bottom and upon widget interaction the app state is reset. Thus, upon changing the page, the previous widget state would be reset.
To address that, you can look into using session state. Please see the following Docs page to get started:
Also, the following forum post seems to be relevant: