New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for using st.session_state
#43
Comments
you are most welcome to help fix this issue, thank you. The changes Streamlit made are large and we haven't had time yet to refactor the code, so any help would be greatly appreciated. As for hydralit_components, it doesn't use the session state, so it will be fine, as all the state usage is only within the Hydralit package. |
Update: I've rewritten the code to avoid using the state hack, and instead use self._session_attrs = {'previous_app': None, 'selected_app': None, 'other_nav_app': None,
'preserve_state': preserve_state, 'allow_access': self._no_access_level, 'logged_in': False, 'access_hash': None}
self.session_state = st.session_state
if isinstance(self._user_session_params, Dict):
self._session_attrs |= self._user_session_params
for key, item in self._session_attrs.items():
if not hasattr(self.session_state, key):
self.session_state[key] = item I've run this by the hydralit-example, and all seems functional (login, changing menus etc). I'll open a PR for further discussion. |
Thanks very much for your hard work saikumarmk! latest package (1.0.14) has ben published. |
As of Streamlit 1.12, the older API used to hack in a SessionState has been entirely deprecated (with an ugly hack to retrieve the Server from the GC) in favour of the built-in
st.session_state
. This comes from the advice of this gist here: https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92I'd be happy to contribute a pull request (I think it should be minor changes), though my only concern is that hydralit_components may require the old SessionState. Could any of the maintainers of either repository comment on this?
The text was updated successfully, but these errors were encountered: