lanl / 4DGB

4D Genome Browser project
1 stars 2 forks source link

Automatically save & restore state. Major overhaul to how state is retained and communicated (rebased) #85

Closed camtauxe closed 2 years ago

camtauxe commented 2 years ago

(This is identical to the previously closed PR #81, except that it's been rebased onto the geom-redesign branch)

Finally! 😌 Sorry this feature took so long to implement, but I am really happy with the results.

This PR enables the application to automatically save and restore it's state, persisting across browser sessions and page reloads. The state is saved silently in the background and will be restored automatically when the page loads. This feature will save:

To achieve this, and to make future changes easier, a major overhaul was made internally to how state is retained, and all of the widgets were ported to this new system. You can find all the details in the code comments and individual commit messages, but in brief:

With this system in place, compare.js has some code set to listen for any event from the Controller. When triggered, it will serialize Controller and save the result in the browser's local storage. When the page loads, we look for a previously saved state and, if there is one, restore it.