St.navigation behavior

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed? YES
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform? NO
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot). N/A
  5. Share the Streamlit and Python versions.
import streamlit as st
st.logo("Banner-GPT-generated.webp")
pages = {
    "Core Features" : [
        st.Page("pgtest_1.py",title="Page 1 Test",icon=":material/settings:"),
        st.Page("pgtest_2.py",title="Page 2 Test",icon=":material/home:")],
    "Admin Features" : [
        st.Page("pages/pgtest_3.py",title="Page 3 Test",icon=":material/public:"),
        st.Page("pages/pgtest_4.py",title="Page 4 Test",icon=":material/menu:")]
}

app = st.navigation(pages)
app.run()

'This content is on nav_main'

all of the pgtest_#.py files are the same:

from streamlit import write as w
w("this is Page 2")

I’m just testing st.navigation and I’m seeing unexpected behavior:

  1. If I navigate to page, 2,3 or 4 and click the browser refresh it hangs. I tried on Brave and Edge with same results. I can break the hang by changing the URL to http://localhost:8501
  2. ’ This content is on nav_main’ shows up on every page, is this by design?
  3. I have a different icon for each page, and when I click on a page from navigation, the icon on my browser tab changes to the icon on the corresponding st.page. Is there a way to over-ride this behavior so that the browser icon remains constant?

Did you figure out the solution for first unexpected behavior am also getting the same error.

I tried the example from st.navigation docs and I’m getting the same issue.

Also, no luck using the /pages method. I created 2 files with a simple st.write in them and a main .py with a st.write too. URL/page2 just shows an endless load.

I’m using a plain env of python 3.12.3, with streamlit 1.36.
With 1.35, this doesn’t happen (at least the /pages approach).

EDIT:

This is known issues and it may be fixed in the nightly build.

1 Like