rmm commited on
Commit
2c18274
Β·
1 Parent(s): 53eb5bc

fix: observations now persist across page switches

Browse files
Files changed (2) hide show
  1. src/home.py +3 -0
  2. src/input/input_handling.py +10 -2
src/home.py CHANGED
@@ -20,6 +20,9 @@ if "MODE_DEV_STATEFUL" not in st.session_state:
20
  from utils.st_logs import init_logging_session_states
21
  init_logging_session_states() # logging init should be early
22
 
 
 
 
23
 
24
  st.write("# Welcome to Cetacean Research Data Infrastructure! πŸ¬ΛšΛ–π“’Φ΄ΰ»‹ πŸ‹βœ§Λš.⋆")
25
 
 
20
  from utils.st_logs import init_logging_session_states
21
  init_logging_session_states() # logging init should be early
22
 
23
+ # set email state var to exist, to permit persistence across page switches
24
+ if "input_author_email" not in st.session_state:
25
+ st.session_state.input_author_email = ""
26
 
27
  st.write("# Welcome to Cetacean Research Data Infrastructure! πŸ¬ΛšΛ–π“’Φ΄ΰ»‹ πŸ‹βœ§Λš.⋆")
28
 
src/input/input_handling.py CHANGED
@@ -339,8 +339,16 @@ def _setup_oneoff_inputs() -> None:
339
 
340
  with container_file_uploader:
341
  # 1. Input the author email
342
- author_email = st.text_input("Author Email", spoof_metadata.get('author_email', ""),
343
- key="input_author_email")
 
 
 
 
 
 
 
 
344
  if author_email and not is_valid_email(author_email):
345
  st.error("Please enter a valid email address.")
346
 
 
339
 
340
  with container_file_uploader:
341
  # 1. Input the author email
342
+ text0 = st.session_state.get("input_author_email", "None")
343
+ #print(f"[D] author email: {text0}")
344
+ author_email = st.text_input("Author Email",
345
+ value=st.session_state.get("input_author_email", None),
346
+ #spoof_metadata.get('author_email', ""),
347
+ #key="input_author_email")
348
+ )
349
+ # store the email in session state
350
+ st.session_state["input_author_email"] = author_email
351
+
352
  if author_email and not is_valid_email(author_email):
353
  st.error("Please enter a valid email address.")
354