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
With the changes made on #7313 to allow "None" values in text box elements, there is now a potential motivation to pass in empty string values via the URL query params. Current implementation of experimental_get_query_params() does not expose the keep_blank_values argument of urllib.parse.parse_qs as an option, and so query strings like
?foo=&bar=helloworld
are parse as {"bar": "helloworld"} instead of {"bar": "helloworld", "foo": ""}
Why?
I am willing to submit a PR for this, since it impacts my streamlit_qs library. Currently I have to re-implement a special version of experimental_get_query_params that exposes this variable.
How?
Add a keep_blank_values argument to experimental_get_query_params which passes this onto parse_qs.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Hey @Asaurus1 , thanks for the writeup on this! We are planning to revamp query params to a dict-style interface more similar to session_state in the near future (expected before the end of the year) and will see how we can incorporate this support in that work. It makes sense that we should make this work.
Given that, I'd rather not add more complexity in the very short term to the current experimental version if you have a workaround, but open to hear feedback / discuss more.
Maybe we can just set the values to None in the new API if they are empty in the URL? This would also nicely match what we're doing for widgets with empty state (and probably solve the original problem here pretty elegantly).
Maybe we can just set the values to None in the new API if they are empty in the URL? This would also nicely match what we're doing for widgets with empty state (and probably solve the original problem here pretty elegantly).
You'd need to solve the problem where some widgets variably return an empty string to represent no value, or None. How would you represent an empty string vs 'none' in query params this way?
Checklist
Summary
With the changes made on #7313 to allow "None" values in text box elements, there is now a potential motivation to pass in empty string values via the URL query params. Current implementation of experimental_get_query_params() does not expose the
keep_blank_values
argument ofurllib.parse.parse_qs
as an option, and so query strings likeare parse as
{"bar": "helloworld"}
instead of{"bar": "helloworld", "foo": ""}
Why?
I am willing to submit a PR for this, since it impacts my
streamlit_qs
library. Currently I have to re-implement a special version ofexperimental_get_query_params
that exposes this variable.How?
Add a
keep_blank_values
argument toexperimental_get_query_params
which passes this ontoparse_qs
.Additional Context
No response
The text was updated successfully, but these errors were encountered: