Hi. I have a multi-page app with 2 pages. I am using st.navigation for navigating between pages.
so I have 3 scripts app.py, and then inside pages folder I have app_home.py, and app_task_history.py
In app.py, I have authentication logic, and if that is successful I load the pages like this -
home_page = st.Page(
page = "pages/app_home.py",
title = 'Home',
default= True,
)
task_history_page = st.Page(
page = "pages/app_task_history.py",
title = 'Task History',
)
pg = st.navigation(pages=[home_page, task_history_page])
pg.run()
The default page is Homepage. Now the problem is, when the user is on the Task History page and reloads the page (not rerun), they are redirected to the Homepage.
What I want is users to stay on the Task History Page. I tried using the combination of session_state[ācurrent_pageā] and st.switch_page() function, but that did not work for me.
So, is it any way to use session_state or something else to make this work?
Thanks.