st.slider returns an old value
See original GitHub issueSummary
Type here a clear and concise description of the bug. Aim for 2-3 sentences.
Steps to reproduce
What are the steps we should take to reproduce the bug:
- Run this script:
max_val = st.selectbox("max", [5, 10, 15], 0)
val = st.slider("main", 0, max_val, 0)
st.write(val)
- Change the value of the “main” slider to 3
- Change the value of the “max value” to 10
- Change back the value of the “max” value to 5
Expected behavior:
The value of the st.write is 0, consistent with the default value of the “main” value and its current value.
Actual behavior:
The value of the st.write is 3 (old value)
Is this a regression?
?
Debug info
- Streamlit version: c2e9d6b0c268f986c2c8588e36bdec08e47f194e Python 3
Additional information
Interestingly, this does not repro if fromUi
in
this.setWidgetValue({ fromUi: false })
in componentDidMount
in Slider.tsx
is set to true
instead of false
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
st.slider - Streamlit Docs
The current value of the slider widget. The return type will match the data type of the value parameter. Examples. age = st.slider('How ......
Read more >Get the previous selection of a slider in streamlit - Stack Overflow
I have a range slider for years. The problem now is, that I want to have the previous selection of this slider. After...
Read more >How to add a slider in streamlit - ProjectPro
You can add a slider to your Streamlit app using "st.slider". ... value -> It is the value that is displayed on the...
Read more >Streamlit from Scratch: Build a Data Dashboard with ...
The st.slider method requires three parameters, a prompt string, and two numerical limits. The return value is one that is between the ...
Read more >Data Visualization with Streamlit - Part II - Topcoder
1 2 st.text_input("Your name", key = "name") st.write("Welcome to you ... The slider method returns the current value of the slider widget.
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
Our solution to this should be resolved with session state. I’ve tagged this issue in it to verify when we release.
I spent a few minutes digging into the history so in case this saves anyone time: #349 was reverted by #753.
(I got here via https://discuss.streamlit.io/t/preserving-state-across-sidebar-pages/107/10 and FWIW it would help me out a lot for this bug to be addressed.)