-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Checklist
- I have searched the existing issues for similar feature requests.
- I added a descriptive title and summary to this issue.
Summary
Recently the switch_page functionality has been integrated in Streamlit 1.30.0, Great! However, it might be handy if we could pass query parameters together with st.switch_page so that it counts as one step in the browser, keeping the back-button to function as expected.
Why?
I'm trying to switch to a different page while adding query parameters to the URL. This would keep specific variables persistent upon subsequent browser page refreshes, since these variables could then be retrieved from the query parameters.
While the same result could be achieved by two consecutive calls - one to st.switch_page, followed by a call to st.query_params - this will cause the browser (Chrome at least) to keep two steps in history. As such, the back-button would not return to the page before the st.page_switch but instead to the page after the switch without query parameters.
How?
def switch_page(page: str, query_params: str)
# e.g.
st.switch_page('pages/next_page.py', 'id=123')
Additional Context
No response