diff --git a/client/components/ModulesTreemap.jsx b/client/components/ModulesTreemap.jsx index ddd596e9..dd726889 100644 --- a/client/components/ModulesTreemap.jsx +++ b/client/components/ModulesTreemap.jsx @@ -209,7 +209,7 @@ export default class ModulesTreemap extends Component { handleConcatenatedModulesContentToggle = flag => { store.showConcatenatedModulesContent = flag; if (flag) { - localStorage.setItem('showConcatenatedModulesContent', '1'); + localStorage.setItem('showConcatenatedModulesContent', true); } else { localStorage.removeItem('showConcatenatedModulesContent'); } diff --git a/client/store.js b/client/store.js index 32c2c2cf..fa5ac88d 100644 --- a/client/store.js +++ b/client/store.js @@ -10,7 +10,7 @@ export class Store { @observable searchQuery = ''; @observable defaultSize; @observable selectedSize; - @observable showConcatenatedModulesContent = localStorage.getItem('showConcatenatedModulesContent') === '1'; + @observable showConcatenatedModulesContent = (localStorage.getItem('showConcatenatedModulesContent') === true); setModules(modules) { walkModules(modules, module => { diff --git a/client/utils.js b/client/utils.js index 8690eb96..70530849 100644 --- a/client/utils.js +++ b/client/utils.js @@ -28,16 +28,16 @@ export const localStorage = { } }, - setItem(k, v) { + setItem(key, value) { try { - window.localStorage.setItem(k, v); - } catch (x) { /* ignored */ } + window.localStorage.setItem(`${KEY_PREFIX}.${key}`, JSON.stringify(value)); + } catch (err) { /* ignored */ } }, - removeItem(k) { + removeItem(key) { try { - window.localStorage.removeItem(k); - } catch (x) { /* ignored */ } + window.localStorage.removeItem(key); + } catch (err) { /* ignored */ } } -}; \ No newline at end of file +};