question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Closing and reopening an expander resets a nested number_input

See original GitHub issue

Summary

A number_input inside an expander resets to the original state when the expander is closed and reopened. The actual returned value is the correct one, but the widget is showing the original value instead.

This does not happen with other widgets (e.g. checkbox or selectbox)

Steps to reproduce

This sample code lets you reproduce the issue:

    expander = st.beta_expander(
        "Open and close me after changing number", expanded=True
    )
    with expander:
        number = st.number_input("Test input")
        st.write(number)

        checkbox = st.checkbox("Test check")
        st.write(checkbox)

        select = st.selectbox("Test select", options=["a", "b"])
        st.write(select)

Expected behavior:

After closing and opening the expander, the number_input keeps its state.

Actual behavior:

The number_input resets to its original state.

Is this a regression?

Don’t know.

Debug info

  • Streamlit version: 0.71.0
  • Python version: 3.7.9
  • Browser version: Chrome 87.0.4280.66

Additional information

Please find attached the screencast showing the bug described above. streamlit-dashboard-2020-11-20-11-11-88

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

4reactions
vdonatocommented, Feb 15, 2022

Thanks everyone for reporting this, and sorry for the much-delayed reply (it’s easy to miss things with all of the GitHub issues activity we get 😅)

I’m fairly certain that I know what the root-cause of this bug is (at least one other widget has run into this problem), and I’ll see if I can find the time to fix this sometime in the next few weeks.

1reaction
gabrielegranellocommented, Apr 26, 2022

I have reported a fairly similar issue here, is there perhaps a connection? https://github.com/streamlit/streamlit/issues/4651

Read more comments on GitHub >

github_iconTop Results From Across the Web

Palate Expander: Uses, Types & Adjusting - Cleveland Clinic
Palate expanders are oral devices used to widen a narrow upper jaw and correct dental conditions like crossbites and overcrowding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found