Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi page application #167

Open
bandoos opened this issue Jan 18, 2023 · 2 comments
Open

Multi page application #167

bandoos opened this issue Jan 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bandoos
Copy link

bandoos commented Jan 18, 2023

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 the app_chat.py containing just

import streamlit as st
st.header("Main page")

create a pages directory besides main_page.py and copy app_chat.py to it.
Now streamlit 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!

@piyopiyo13
Copy link

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__'

@whitphx whitphx added the bug Something isn't working label Apr 16, 2023
@kk19990709
Copy link

I'm facing the same question, wondering how to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants