mirror of
https://github.com/nasa/openmct.git
synced 2025-01-10 23:12:57 +00:00
safer access to localStorage
initial state
ie. legacy localStorage having `expanded` but not `multiline`
This commit is contained in:
parent
e494bee1ff
commit
a54affd36d
@ -208,13 +208,15 @@ export default {
|
||||
},
|
||||
inject: ['openmct'],
|
||||
data: function () {
|
||||
let storedHeadProps = window.localStorage.getItem('openmct-shell-head');
|
||||
let headExpanded = true;
|
||||
let indicatorsMultiline = true;
|
||||
if (storedHeadProps) {
|
||||
headExpanded = JSON.parse(storedHeadProps).expanded;
|
||||
indicatorsMultiline = JSON.parse(storedHeadProps).multiline;
|
||||
}
|
||||
const DEFAULT_HEAD_EXPANDED = true;
|
||||
const DEFAULT_INDICATORS_MULTILINE = true;
|
||||
|
||||
const storedHeadProps = JSON.parse(localStorage.getItem('openmct-shell-head'));
|
||||
const storedHeadExpanded = storedHeadProps?.expanded;
|
||||
const storedIndicatorsMultiline = storedHeadProps?.multiline;
|
||||
|
||||
const headExpanded = storedHeadExpanded ?? DEFAULT_HEAD_EXPANDED;
|
||||
const indicatorsMultiline = storedIndicatorsMultiline ?? DEFAULT_INDICATORS_MULTILINE;
|
||||
|
||||
return {
|
||||
fullScreen: false,
|
||||
|
Loading…
Reference in New Issue
Block a user