-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
History
On every state change, the Dashboard has backed up its state into session storage since early 7.x.
First this was accomplished at the Dashboard level. Meaning if one embeddable reported unsaved changes, the entire panels state was backed up into session storage.
React Embeddable backups
With the new React Embeddable system, we tried a different tactic. Instead of backing up the entire panels array, we backed up the specific differences in runtime state for each embeddable. I.e. if an embeddable had 5 state keys, and only one had changed, only the value of that one key would be backed up. This helped us store fewer duplications of state. When the Embeddable was re-hydrated those backed up state keys would be applied over top of any runtime state which was deserialized.
Problems with this system
This backed up runtime state is stored separately from the rest of the Dashboard state. This means that the actual state of the panels saved in the Dashboard doesn't contain the latest serialized state until the serialize method is called on save. This is a major contributor to #215429.
Future
We should modify this system to remove the separate layer of runtime state backups and instead serialize the entire embeddable on any change. This is the midpoint between serializing the entire panels array, and serializing only the specifically changed state keys for each embeddable. This should be done before #215427