Just getting into Streamlit and have successfully been using session.state to save the state of some sliders on a Streamlit page.
Worked well in 0.88. Upgraded to 1.0 today and session.state appears to have stopped working.
Can’t find any info on this in the docs. - does it need some sort of cache clear?
Thanks.
Hi @steeley, welcome to the community!

I’m sorry to hear you’re having trouble using the Session State API. It would help if you could provide a reproducible code example demonstrating this behavior.
With Streamlit 1.0, I’m able to save the state of a slider widget as a Session State variable. Every widget with a key is automatically added to Session State. To learn more, check out Session State and Widget State association

Best, 
Snehan
Thanks for the reply Snehan.
The important thing here is that I need to keep my slider values if I navigate to another streamlit page and back again.
As stated, my code has not changed - I simply updated to v 1.0 from 0.88. so that iis why I ask if the API has changed.
I tried your example as written, but it seems that the key is not automatically added, so I get an error
stating this. it only works if I do this:
import streamlit as st
if 'myslider' not in st.session_state:
st.session_state.myslider = 0
slider = st.slider("my_slider",0,100,key="mySlider")
st.write('st.session_state["myslider"]=',st.session_state["myslider"])
my original code below, worked perfectly in 0.88 , the keys are saved and my sliders are remembered if I go to another streamline page and come back again.
import streamlit as st
if 'gen_level' not in st.session_state:
st.session_state.gen_level = 0
if 'gen_freq' not in st.session_state:
st.session_state.gen_freq = 5
if "gen_balance" not in st.session_state:
st.session_state.gen_balance = 0.0
st.slider('Level', min_value=0, max_value=10, key = 'gen_level')
st.write(" ")
st.slider('freq', min_value=0, max_value=10, key = 'gen_freq')
st.write(" ")
st.slider("balance", min_value=-10.0, max_value=10.0, key="gen_balance")
st.write(st.session_state.gen_balance)```
Thanks.
Did you find a solution? Stumbled into the same problem 