Retain page state in multi-page apps when visiting other pages

One way to do this would be to hide/show content instead of removing/adding content. It will make the app slower (because all of the content needs to be loaded upfront) but it would be an easy way to preserve state.

Here’s an example: dash-recipes/dash-urls-hide-show-tabs.py at master · plotly/dash-recipes · GitHub

There might be other ways to do this as well, like saving the data in a hidden div that is in the “global” app.layout and then feeding state from that hidden div into the underlying page’s controls.

Let us know what you end up with!

4 Likes