Question about changing query parameters (st 1.30)

Hi all!

I encountered a problem after updating streamlit 1.30. The problem concerns a new (changed) function - query_params .

Previously, when using the experimental version, the specified query parameters were saved and could be used on other pages. Now, after setting a query parameter on one page, it is reset when moving to another.

Tell me, is this a feature of the implementation or is it a bug? Thx.

Win10, Py 3.11.7, Streamlit 1.30 locally.

Hey @kharlamarla,

Thanks for flagging this issue! Is your app using st.rerun? Query parameters are expected to persist across pages, but there is currently a confirmed bug with st.query_params when used in conjunction with st.rerun (GitHub Issue here)

1 Like

Thanks for your reply. Yes, my code uses st.rerun, but in the logic of displaying two pages (when switching between them) this function is not called.

I wrote code for demonstration that does not use st.rerun and shows the essence of the error. I also attached a video. Please have a look.

1 Like

Thanks so much for sharing that example! Iโ€™ve investigated this further and this is actually intended behavior to simulate the same behavior of regular webpages.

Here are a few related GitHub Issues that explain the decision to make this change in more detail: #6725, #5505, #7982

1 Like

Thanks for providing details of the changes to this approach. It would probably be great to show this information in the documentation so that it is explicit.

Thanks a lot.

1 Like

Iโ€™ll look into making the note more visible. Itโ€™s currently the last sentence before the โ€œRepeated keysโ€ section on the st.query_params page. Since itโ€™s just one line, itโ€™s definitely easy to miss. Thanks for highlighting.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.