diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index 38bc640d9..af9d70a97 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -89,19 +89,23 @@ RED.palette = (function() { } function rememberCategoryState(cat, open) { const stateStr = localStorage.getItem('closedCategories'); - if (!stateStr && open) return; + if (!stateStr && open) { + return; + } const state = stateStr ? JSON.parse(stateStr) : []; const idx = state.indexOf(cat); - if (open && idx >= 0) + if (open && idx >= 0) { state.splice(idx, 1); - else if (!open && idx < 0) + } else if (!open && idx < 0) { state.push(cat); - else + } else { return; - if (state.length <= 0) + } + if (state.length <= 0) { localStorage.removeItem('closedCategories'); - else + } else { localStorage.setItem('closedCategories', JSON.stringify(state)); + } } function setLabel(type, el,label, info) { @@ -427,10 +431,11 @@ RED.palette = (function() { if (categoryNode.find(".red-ui-palette-node").length === 1) { const closedCategoriesStr = localStorage.getItem('closedCategories'); const closedCategories = closedCategoriesStr ? JSON.parse(closedCategoriesStr) : []; - if (closedCategories.indexOf(rootCategory) < 0) + if (closedCategories.indexOf(rootCategory) < 0) { categoryContainers[rootCategory].open(); - else + } else { categoryContainers[rootCategory].close(); + } } }