Clear stale file selector when navigating to empty folder

Removes leftover file_selector and loaded_file state when the current
directory has no JSON files, preventing stale data from persisting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 17:01:50 +01:00
parent 1abae0de22
commit bd628b062e

3
app.py
View File

@@ -162,6 +162,9 @@ with st.sidebar:
selected_file_name = st.radio("Select File", file_names, key="file_selector")
else:
st.info("No JSON files in this folder.")
if 'file_selector' in st.session_state:
del st.session_state.file_selector
st.session_state.loaded_file = None
# --- GLOBAL MONITOR TOGGLE (NEW) ---
st.markdown("---")