Issue with dynamic display using st.session_state in Streamlit
#37
AntoniaJost
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I've currently enhanced our Streamlit app to include an option for users to toggle the display of detailed, additional information (such as plots and additional data) beyond an initial report. The goal is to allow users to view or hide this extra information at will, without re-triggering the generation of the main report.
Expected Behavior
The ideal functionality would enable toggling additional information on/off seamlessly after the report is being created:
Current Behavior
Unfortunately, leveraging
st.session_statefor this purpose leads to suboptimal behaviour. The current implementation requires users to press the "generate" button again to apply changes in the toggle state (show/hide additional information). This results in the entire report being re-rendered, which is not the desired outcome.Attempted Workarounds
Several workarounds to manipulate
st.session_statewere attempted, but none provided a satisfactory solution to update the UI dynamically in the desired manner.Possible Solutions
st.session_state.Additional Context
This issue seems to be rooted in the way Streamlit handles session states and dynamic UI updates. It reflects a broader challenge with achieving interactive logic in Streamlit applications without compromising user experience or app performance.
Beta Was this translation helpful? Give feedback.
All reactions