mirror of
https://github.com/nasa/openmct.git
synced 2025-01-25 13:49:56 +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'],
|
inject: ['openmct'],
|
||||||
data: function () {
|
data: function () {
|
||||||
let storedHeadProps = window.localStorage.getItem('openmct-shell-head');
|
const DEFAULT_HEAD_EXPANDED = true;
|
||||||
let headExpanded = true;
|
const DEFAULT_INDICATORS_MULTILINE = true;
|
||||||
let indicatorsMultiline = true;
|
|
||||||
if (storedHeadProps) {
|
const storedHeadProps = JSON.parse(localStorage.getItem('openmct-shell-head'));
|
||||||
headExpanded = JSON.parse(storedHeadProps).expanded;
|
const storedHeadExpanded = storedHeadProps?.expanded;
|
||||||
indicatorsMultiline = JSON.parse(storedHeadProps).multiline;
|
const storedIndicatorsMultiline = storedHeadProps?.multiline;
|
||||||
}
|
|
||||||
|
const headExpanded = storedHeadExpanded ?? DEFAULT_HEAD_EXPANDED;
|
||||||
|
const indicatorsMultiline = storedIndicatorsMultiline ?? DEFAULT_INDICATORS_MULTILINE;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fullScreen: false,
|
fullScreen: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user