Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Yuriy Grunin <[email protected]>
  • Loading branch information
lorenzos and th0r authored Oct 11, 2019
1 parent 8065918 commit b4a48f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/components/ModulesTreemap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion client/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
14 changes: 7 additions & 7 deletions client/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ }
}

};
};

0 comments on commit b4a48f3

Please sign in to comment.