Closed andrew-mitchell-721 closed 1 year ago
Never mind! Solved it by storing now
in st.session.state
and refreshing it on each reload:
count = st_autorefresh(interval=3000, key='counter')
if 'now' not in st.session_state:
st.session_state.now = datetime.now().astimezone(tz=timezone('US/Mountain')).replace(tzinfo=None)
else:
del st.session_state.now
st.session_state.now = datetime.now().astimezone(tz=timezone('US/Mountain')).replace(tzinfo=None)
Thanks for this great component! I'm having a problem and not sure if it's user error or expected behavior. Trying to refresh every 5 minutes. I have a module within my app that defines a few constants like:
I'd like to refresh the value of
NOW
each time the script reruns, as another part of the module completes an API recall based on the value ofNOW
. However, when I instantiate st_autorefresh, the reload doesn't update the value of NOW upon refresh.Am I missing something? Thanks!