Open bandoos opened 1 year ago
I'm having a similar issue. I have an app with an st.selectbox
providing access to the different pages. I also have a background Thread
from threading
periodically updating a pandas DataFrame
stored in server_state
. I've noticed that whenever this DataFrame
gets refreshed, the ensuing rerun causes the browser to return to the main page. The dropdown menu corresponding to the st.selectbox
maintains the user-selected value in the browser, but if I call st.write
on st.session_state
, it shows that the variable value of the st.selectbox
has been overwritten with the main page. It almost seems like the rerun is a "hard" rerun, where st.session_state
is getting reset to default values.
I've tried suppressing the rerun by wrapping updates with no_rerun
, planning on using the package st_autorefresh
to do the reruns from the client side instead, but get the below error. I probably need to clarify ctx for the thread, but I'm not sure exactly what to do.
/miniconda3/lib/python3.9/site-packages/streamlit_server_state/rerun_suppression.py", line 23, in __enter__
setattr(ctx, _SERVER_STATE_RERUN_SUPPRESSION_ATTR_NAME_, True)
AttributeError: 'NoneType' object has no attribute '__SERVER_STATE_SUPPRESS_RERUN__'
I'm facing the same question, wondering how to fix
Hello @whitphx, thanks a lot for this library, great work!
I have a question regarding its usage in multipage streamlit applications.
It seems there is a bit of glitches when the application has multiple pages. To reporduce what I'm talking about just create a
main_page.py
besides theapp_chat.py
containing justcreate a
pages
directory besidesmain_page.py
and copyapp_chat.py
to it. Nowstreamlit run main_page.py
should open a multipage app, navigate to the chat page with the sidebar, open 2 instances in 2 browser tabs and try to chat. It looks like on some (but not all) occasions the reload also forces the other app go back to main page instead of chat page.Let me know if you can reproduce the bug!