Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None Selected #13

Open
444B opened this issue Mar 2, 2024 · 2 comments
Open

None Selected #13

444B opened this issue Mar 2, 2024 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@444B
Copy link
Owner

444B commented Mar 2, 2024

Original issue by hansipie on 2024-02-02 18:22:02+00:00

Hello,

Defining a selectbox like this :
select = st.selectbox("title", ("A", "B"), index=None)
... I get a KeyError exception at main.py:162
This is caused by the default "None" value. It is changed into an empty space by "replace_empty(...)", but
if selected != st.session_state.state_dict.get(label, None): goes into the "true" statement, and causes an exception.

The fix at main.py:161:
if selected != st.session_state.state_dict.get(label, " "):

I make a PR or let you fix ...

@444B
Copy link
Owner Author

444B commented Mar 2, 2024

@hansipie is this still relevant?

@444B 444B self-assigned this Mar 2, 2024
@444B 444B added bug Something isn't working good first issue Good for newcomers labels Mar 3, 2024
@hansipie
Copy link

hansipie commented Mar 13, 2024

Hello.
First of all sorry for the delay ...
Yes it does... this is a sample to reproduce:

import streamlit as st
import streamlit_analytics2 as streamlit_analytics

with streamlit_analytics.track():
    options = st.selectbox("options", ("option 1", "option 2"), index=None)
    st.info(options)

The fix I proposed was a first idea and needs to be explored further.

PS: Thx for this fork :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants