Currently, every chart has a currentlyActive boolean field and the viewer searches for the first chart where currentlyActive === true when deciding which one to display. There should only ever be one currently-active chart, so this is a pretty wonky system.
The redesign adds a new uuid field to uniquely identify each chart, which can be used to restructure how charts are handled in local storage, something like below where currentlyActive is a top-level field that contains a UUID and the charts array is turned into an object where the UUIDs are keys.
Currently, every chart has a
currentlyActive
boolean field and the viewer searches for the first chart wherecurrentlyActive === true
when deciding which one to display. There should only ever be one currently-active chart, so this is a pretty wonky system.The redesign adds a new
uuid
field to uniquely identify each chart, which can be used to restructure how charts are handled in local storage, something like below wherecurrentlyActive
is a top-level field that contains a UUID and thecharts
array is turned into an object where the UUIDs are keys.Before
After
This would greatly simplify a lot of the code that deals with switching between charts, identifying or setting the currently active one, etc.