Is it possible to save the state of a app so that you can pick up when you left off after refresh?

I have a dash app that hosts a model with an interactive interface. As part of development I need to tweak parameters often, and there are a lot of them. The problem is that each time I change an aspect of the model I need to reload the webpage and all of my options reset to default. This is a pain. Is there any way I can save the state of the app and reload this state on refresh? (i.e. with all the options I’ve just configured last time around)?

1 Like

You can save your state in the URL. Here is an example gist

@cw00137 As of dash==1.3.0, Dash now supports prop persistence in local storage for many components in dcc and in the table. There’s a usage example in 📣 Dash 1.3.0 released.

Additional tweaking can be on the persistence props to change the persisted props, the type of persistence and to allow multiple persisted sets of values per component as described in components props reference (e.g.

In dcc,

  • Checklist, Dropdown, Input, RadioItems, RangeSlider, Slider,Tabs,Textareacan persistvalue`
  • DatePickerRange can persist start_date and end_date
  • DatePickerSingle can persist date

In the table: column_name, data (opt-in), selected_columns, selected_rows, sort_by

Hope this helps!

1 Like

Here’s an example of how you can save the state of the app in a querystring:

This makes the state of the app not only persistent but also shareable. Although if you have a lot of querystring parameters I would suggest implementing a tinyurl shortener in your app. (example also shown in the above github repo)