You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues for similar feature requests.
I added a descriptive title and summary to this issue.
Summary
Currently, updating query parameters via st.query_params removes fragment identifiers, if one is present in the URL. This makes it so that links to the page intended to jump to a subsection of the page will fail to jump to the subsection if query params are modified before that subsection is generated.
Why?
I have an app with multiple sections, and I'd like to send emails out with a link to specific subsections, like myapp.com/?account_id=123#subsection. During generation of the app, before generating the subsections I'd want to link to, the query params get read and modified, which removes the #subsection fragment identifier, so the page doesn't jump to that section once it's generated.
Navigating to http://localhost:8501/#subsection does not jump to the subsection because of the query params modification. But if you comment that out, it works just fine.
How?
The change I'm suggesting would likely only be an internal change. I imagine the expected behavior of modifying query params would be preserving the fragment identifier and preserving the ability to jump to the specified id.
jrieke
changed the title
Preserve fragment identifier when updating query params
Preserve URL fragment identifier when updating query params
Oct 14, 2024
Checklist
Summary
Currently, updating query parameters via
st.query_params
removes fragment identifiers, if one is present in the URL. This makes it so that links to the page intended to jump to a subsection of the page will fail to jump to the subsection if query params are modified before that subsection is generated.Why?
I have an app with multiple sections, and I'd like to send emails out with a link to specific subsections, like
myapp.com/?account_id=123#subsection
. During generation of the app, before generating the subsections I'd want to link to, the query params get read and modified, which removes the#subsection
fragment identifier, so the page doesn't jump to that section once it's generated.As a minimal example, with this app:
Navigating to
http://localhost:8501/#subsection
does not jump to the subsection because of the query params modification. But if you comment that out, it works just fine.How?
The change I'm suggesting would likely only be an internal change. I imagine the expected behavior of modifying query params would be preserving the fragment identifier and preserving the ability to jump to the specified id.
Additional Context
Here is a forum question from someone else whose issue would likely be resolved by this change: https://discuss.streamlit.io/t/query-params-anchors/77951/2
The text was updated successfully, but these errors were encountered: