Streamlit: selectbox not working as expected when "navigating between pages"

Created on 13 Oct 2019  路  3Comments  路  Source: streamlit/streamlit

Summary

I have a multipage app with a Home page and Resources page. On the Resources page I have a multiselect widget. If I select something in that multiselect, navigate back to the home page and navigate back to the "Resources page" then the multiselect shows as empty but the list return from the multiselect is not empty.

Minimum Example

"""This is a minimum replicating example of this issue
https://github.com/MarcSkovMadsen/awesome-streamlit/issues/7"""
import streamlit as st

pages = ["Home", "Resources"]
tags = ["Awesome", "Social"]

page = st.sidebar.radio("Navigate", options=pages)
st.title(page)
if page == "Resources":
    selection = st.multiselect("Select tag", tags)
    st.write(selection)

Steps to reproduce

What are the steps we should take to reproduce the bug:

  1. run the code using streamlit run <code_file.py>
    image
  1. Navigate to the Resources page
    image

  2. Select the social tag
    image

  3. Navigate back to Home
    image

  4. Navigate back to Resources

image

Expected behavior:

I would expect in step 5 that either

  • The multiselect returns an empty list (Preferred).

or

  • The multiselect shows the "Social" tag as selected (Alternative).

Actual Behaviour

The multiselect returns a different list than it shows

bug

Most helpful comment

Closing this as we did not receive an answer in few days, if you still having problems please fell free to re open it.

All 3 comments

Thanks for sending the minimum example, @MarcSkovMadsen ! This is extremely helpful! I'll see when the eng team can take a look a this.

@MarcSkovMadsen Thanks for taking your time testing streamlit!
this had been fixed in version 0.48.0 , which streamlit version are you using?

Closing this as we did not receive an answer in few days, if you still having problems please fell free to re open it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kurt-rhee picture kurt-rhee  路  3Comments

imneonizer picture imneonizer  路  3Comments

randyzwitch picture randyzwitch  路  3Comments

danlester picture danlester  路  3Comments

equester picture equester  路  3Comments