Hi, thanks for the example. I ran some tests with your code sample this morning, and with a variant with a complex menu added. I can confirm that:
Menus always work correctly, whether flat or complex
The buttons on the home page work correctly with flat menus
The duplication occurs when using the button on the Home page when the menu set is complex.
In case 3 I was able to see a streamlit exception in the “loading_app” module by setting a breakpoint and stepping through with the debugger.
(Pdb) n
streamlit.script_runner.RerunException: RerunData(query_string=None, widget_states=None)
c:\apps\anaconda3\envs\dplogging\lib\site-packages\hydralit\loading_app.py(11)run()
→ app_target.run()
(Pdb) s
c:\apps\anaconda3\envs\dplogging\lib\site-packages\hydralit\loading_app.py(11)run()
→ app_target.run()
It looks like the script gets run twice on the button click, the first time the exception gets thrown. In normal running it appears the exception gets swallowed up somewhere and isn’t reported. Buttons often have weird side effects especially when used in combination with reruns.
For me the workaround is not to use buttons with complex menus, I don’t really need them. But thank you anyway, after stepping through this code I can see it is a really well designed and executed approach.
I really appreciate your analysis, this is very helpful. After your initial question, i ran a different round of tests and did find the bug you discovered with the complex nav, I will push a new release shortly that fixes that issue. The bug is actually in a branch condition that most people (including myself) never hit whereby there is no Login app with a complex nav. Thank you for taking the time to help investigate, your analysis will definitely be put to use, ultimately the bug comes from 1 line of code that should have been removed when i integrated the new nav bar, thanks again, will post when the new release is available.
A new version of Hydralit has been released with a number of performance improvements and bug fixes. Please also see the note below regarding the use of internal links.
A showcase live demo, including the fun Loader Playground app demonstrating the 20+ animated loaders now available within the Hydralit Components package has been updated with all the new features.
After alot of work on this package and a major release of Hydralit Components, this will be my last release for a while as there are plenty of opinions available within this community on how best to do multiple component Streamlit application.
I’m not interested in competing with dogmatic comments and gang-up style responses from a select few here, therefore a big thank you to everyone who has contributed, enjoyed and gained something from Hydralit and related projects and I wish you all the best.
I will continue to maintain the packages and if issues are found, I will be monitoring the issue tracker on the repos, I just won’t be pushing new features, functions, nice to haves, query parameters or security features and integrations further at this time.
Latest features
Can set auto login with guest account when using a secure app
Support for a non-secure app in a secure app (like a signup app)
Full integration with the Hydralit Navbar that now supports complex nav!
some bug fixes where app to app redirect was inconsistent
Banners
Compression behind download button
Hydralit Navbar
Can turn off the navbar animation now! (must be using Hydralit_components >=1.0.4)
NOTE
Due to the Streamlit execution model, the ability to use internal nav links from a child app is one-shot when using the navbar. This means that the internal link will redirect to the child, however if a script rerun request is made within the child app (changing the value of a widget for example), the nav will bounce back to the calling app. You can disable the navbar and the Streamlit core components nav menu will appear and the internal links will work as expected.
A quick fix update for those that are in a hurry when wanting multi-page apps with Hydralit.
Now you can just wrap your functions with a decorator and get all the goodness of state management, auto generated navbar and so much more.
import hydralit as hy
app = hy.HydraApp(title='Simple Multi-Page App')
@app.addapp()
def my_home():
hy.info('Hello from app1')
@app.addapp()
def app2():
hy.info('Hello from app 2')
#Run the whole lot, we get navbar, state management and app isolation, all with this tiny amount of work.
app.run()
If you want to put alittle bit of kick on them with labels and icons, you can do it directly from the decorator. You don’t even need to import Streamlit, as it’s there for you already, one import to create all the apps and have access to all the Streamlit functionality.
#when we import hydralit, we automatically get all of Streamlit
import hydralit as hy
app = hy.HydraApp(title='Simple Multi-Page App')
@app.addapp(is_home=True)
def my_home():
hy.info('Hello from Home!')
@app.addapp()
def app2():
hy.info('Hello from app 2')
@app.addapp(title='The Best', icon="🥰")
def app3():
hy.info('Hello from app 3, A.K.A, The Best 🥰')
#Run the whole lot, we get navbar, state management and app isolation, all with this tiny amount of work.
app.run()
Hi, may I know how to DM you? Currently I faced a problem. I got few apps which can directed at the sidebar, now I want to link the sidebar and nav bar (using hydralit_components) which when I click on the nav bar, then it can directly me to the different app (so called multi pages), may I know how to do it? and also is it possible to applied using hydralit_components?
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.