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:
3
app.py
3
app.py
@@ -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("---")
|
||||
|
||||
Reference in New Issue
Block a user