Skip to content

Commit 529adbe

Browse files
committed
chore(5-min-viz): clear out stale district/station info
if a station is selected and then de-selected, some information associated with the station is not cleared, i.e., Absolute Post Mile and Lanes stay greyed out, Streamlit's sign of "stale data". it turns out that the st.empty() method sometimes needs some time to take effect on the front-end. adding a small delay ensures that the DOM is ready for st.empty().
1 parent 508e027 commit 529adbe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pems_streamlit/src/pems_streamlit/apps/districts/app_stations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
import time
23

34
import pandas as pd
45
import streamlit as st
@@ -72,6 +73,7 @@ def main():
7273
map_placeholder = st.empty()
7374

7475
with map_placeholder:
76+
time.sleep(0.1)
7577
if station:
7678
df_selected_station = df_station_metadata.query("STATION_ID == @station")
7779
map_station_summary(df_selected_station)

0 commit comments

Comments
 (0)