Skip to content

experimental_get_query_params won't work before rerun  #6347

@PaleNeutron

Description

@PaleNeutron

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

User can not get right query_params before rerun.

Reproducible Code Example

import streamlit as st

st.experimental_set_query_params(param=3)
st.write(st.experimental_get_query_params())

Steps To Reproduce

Run script, {"param ": 3} will not appear at first time until rerun script after querystring in browser already changed.

Expected Behavior

Show {"param ": 3}

Current Behavior

show empty dict

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.20.0
  • Python version: 3.10.6
  • Operating System: Linux
  • Browser: Chrome
  • Virtual environment: None

Additional Information

In previous version set_query_params will set ctx.query_string = parse.urlencode(query_params, doseq=True) immediately.

But in 1.20, this line is removed while get_query_params still get if from ctx.query_string .

Are you willing to submit a PR?

  • Yes, I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:query-paramsRelated to `st.query_params`priority:P1High priority - fix within two weeksstatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedtype:regressionThis bug is a regression from previous behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions