James McCool commited on
Commit
3d22ef0
·
1 Parent(s): a8db79e

Refactor session state management in Streamlit app to retain specific keys during initialization. This change ensures that only essential session data is preserved, enhancing the app's performance and user experience.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +4 -1
src/streamlit_app.py CHANGED
@@ -6,8 +6,11 @@ import re
6
 
7
  print(f"Streamlit version: {st.__version__}")
8
 
 
 
9
  for key in list(st.session_state.keys()):
10
- del st.session_state[key]
 
11
 
12
  st.set_page_config(layout="wide")
13
 
 
6
 
7
  print(f"Streamlit version: {st.__version__}")
8
 
9
+ maintained_keys = ['tab_selector', 'site_var', 'view_var']
10
+
11
  for key in list(st.session_state.keys()):
12
+ if key not in maintained_keys:
13
+ del st.session_state[key]
14
 
15
  st.set_page_config(layout="wide")
16