-
Notifications
You must be signed in to change notification settings - Fork 292
Description
I'm encountering a flicker/double load issue on startup when using the streamlit-authenticator-mongo package for authentication in my Streamlit app. The problem is that when a user first visits the app, the session state for authentication (st.session_state["authentication_status"]) is initially None, which triggers the login screen. Shortly after, the authentication process sets this value to True (for authenticated users), and the app re-runs, switching to the main screen. This results in the following sequence:
- Initial Run:
st.session_state["authentication_status"] is None.
The code treats this as an unauthenticated state and displays the login screen.
- Subsequent Run:
The authentication library updates st.session_state["authentication_status"] to True.
The app re-runs and displays the main UI.
This causes a brief but noticeable flicker where the login screen appears before the main content is rendered, even if the user is already authenticated.
menu = ["Login", "Register"]
choice = st.sidebar.selectbox("Menu", menu)
if choice == "Login":
authenticator.login('Login', 'main')
elif choice == "Register":
# Registration form logic...```