Closing and reopening an expander resets a nested number_input
See original GitHub issueSummary
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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I have reported a fairly similar issue here, is there perhaps a connection? https://github.com/streamlit/streamlit/issues/4651