St-pages - Updating a Dynamic Sidebar Menu

First post here so forgive me if I botch thisā€¦

Iā€™m using st-pages (love it!) and many of my pages make st.radio calls to select data. When I make a selection, no matter the page, I change the corresponding st.session_state variable and my widgets all update immediately, including those in the sidebar.

The problem I am havingā€¦ even though all the ā€œwidgetsā€ update, my st-pages ā€œdynamicā€ menu does not.

To build/display that menu Iā€™ve defined a menu( ) function as:

# menu( ) - Build and display the dynamic page menu in the sidebar
# --------------------------------------------------------------------------------------
def menu(top_of_page=True):
    pages = [ Page("main.py", "Home", "šŸ "), 
                Page("login.py", "Login to OBFUSCATED.com", "šŸ’Ŗ"),
                Section(name="Load Waypoints", icon=":pushpin:"),
                    Page("load_gpx.py", "From a GPX File", ":open_file_folder:"),
                    Page("query.py", "Query OBFUSCATED.com", ":question:" ),
                Section(name="Visualize Data", icon=":bar_chart:"),    
                    Page("map_waypoints.py", "Map Waypoints", ":world_map:") ] 
    
    if not state('loaded'):
        hide_pages( ["Visualize Data", "Map Waypoints"] )
    if not state('connected'):
        hide_pages( ["Query OBFUSCATED.com"] )

    show_pages(pages)
    if top_of_page:
        add_page_title( )   # necessary for proper menu indentation

    return 

My state( ) function is just shorthand to return an st.session_state variable. I call menu( ) at the top of every page, and tried callingmenu(False) at the bottom of every page, but that didnā€™t help with my problem.

I suspect Iā€™m missing something simple here, or maybe my design isnā€™t what it should be. Anyone have a suggestion?

For now, Iā€™m going to comment out the hide_pages( ) calls and add some logic in each page to determine if conditions are right to run the page or not. That way my menu wonā€™t need to be ā€œdynamicā€ at all, and it wonā€™t keep collapsing and failing to expand when needed.

This makes me wonder if st_pages has, or might one day have, the ability to ā€œdisableā€ a page such that if/when it is clicked it gets grayed out, maybe with a simple popup explaining that the page is currently disabled?