Within one of the pages, I have st.spinner since I have an operation that takes awhile to run. I noticed that when it is running, the tab in my browser reverts back to saying “Streamlit” and showing the default Streamlit icon.
I would definitely prefer if it kept my page_title and page_icon the same, so I’m wondering if this is the intended behavior or a bug/something overlooked.
Ok, so when setting up a toy example, it looks like this behavior is only happening on Google Cloud Run, which is where I am running my other project. I tried it on Streamlit.io and wasn’t getting the same behavior
However, I also discovered that it only happens when the spinner is within a button and not just on its own
For what it’s worth, I usually run on Chrome, but I tried it in Edge and am getting the same behavior there too
I don’t think you’re doing anything wrong, it’s just a side-effect of the way callbacks work – they run before everything else on the page, in this case including st.set_page_config. I don’t know of anything besides not doing the st.spinner in a callback, unfortunately. I’m not sure, but streamlit.io might be doing something special to cache the name and icon so that it avoids this issue.
As of Streamlit version 1.46.0, you can call st.set_page_configuration multiple times in the same script run. So you can call st.set_page_config at the beginning of your callback function where needed.
I can think of two ways to access the page title within a callback:
Dig into the internals of Streamlit to pull out the page title from the current script context/page manager (a little messy).
Save the page title into Session State, updating immediately after st.navigation in your entrypoint file so that it’s available to your callback functions.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.