fix: resolve KeyError for selected_analysis_id in session_state
This commit is contained in:
@@ -773,6 +773,10 @@ def page_history():
|
||||
|
||||
st.markdown("---")
|
||||
|
||||
# 세션 상태 초기화 (최초 방문 시 기본 보고서 ID 세팅)
|
||||
if "selected_analysis_id" not in st.session_state:
|
||||
st.session_state["selected_analysis_id"] = records[0]["id"] if records else 1
|
||||
|
||||
# 세션 상태 보정 (현재 필터링된 목록에 세션 ID가 없으면 첫 번째 항목으로 강제 세팅)
|
||||
valid_ids = [r["id"] for r in records]
|
||||
if st.session_state["selected_analysis_id"] not in valid_ids and records:
|
||||
|
||||
Reference in New Issue
Block a user