Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Create a sidebar with user-specific attributes after authentication

I’ve created a login page that uses flask-login to maintain authentication of a user. The login page does not have a sidebar.

After the user enters valid credentials and clicks a button, a home page is rendered. There is a sidebar on the home page and all other pages. Now I would like to add to the sidebar a DropdownMenu with DropdownMenuItems pulled from the current_user’s attributes. I can do this, too: for each pathname change after authentication, I can re-render the sidebar. The downside of this approach is that the user’s attributes have to be pulled each time they change pages, in addition to the (unnecessary?) re-instantiation of the DropdownMenuItems.

Is targeting the children of DropdownMenu with a callback a better approach? How would I implement it? The sidebar isn’t returned as content until after authentication, but the trigger for returning the DropdownMenuItems has to happen at authentication time, so I can’t make the Inputs a button click and the Outputs the DropdownMenuItems.