Skip to content
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

Session state for Streamlit app #18

Open
luigibrancati opened this issue Jul 10, 2023 · 0 comments
Open

Session state for Streamlit app #18

luigibrancati opened this issue Jul 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@luigibrancati
Copy link
Collaborator

As mentioned in this PR #15, in each page we initialize the session state variables relevant to the page, e.g. on module Anomalies Plot.py we do

if "eac4_anomalies_start_date" not in st.session_state:
    st.session_state["eac4_anomalies_start_date"] = datetime(2022, 1, 1)
if "eac4_anomalies_end_date" not in st.session_state:
    st.session_state["eac4_anomalies_end_date"] = datetime(2022, 12, 31)
if "eac4_anomalies_times" not in st.session_state:
    st.session_state["eac4_anomalies_times"] = ["00:00"]

Is there a better way? Maybe initialize all used vars in session state at the beginning of the program? Or using a config file?

@luigibrancati luigibrancati added the enhancement New feature or request label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant