From c06c3943010cb941230e7e5d15ba86ccaa1ba2ff Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Wed, 28 Feb 2024 16:44:51 +0000 Subject: [PATCH] Address lint issues --- shell/store/index.js | 2 +- shell/store/type-map.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/shell/store/index.js b/shell/store/index.js index bb7cb10dc33..927e1bfd017 100644 --- a/shell/store/index.js +++ b/shell/store/index.js @@ -297,7 +297,7 @@ export const getters = { // falls back to the explorer product and then the first active product. currentProduct(state, getters) { let product = state.productId || EXPLORER; - let cache = {}; + const cache = {}; // Rather than determining all active products, just check the current product (more performant) let res = getters['type-map/isProductActive'](product, cache); diff --git a/shell/store/type-map.js b/shell/store/type-map.js index b04089ad3c8..88b1aeaecec 100644 --- a/shell/store/type-map.js +++ b/shell/store/type-map.js @@ -1360,7 +1360,7 @@ export const getters = { /** * Returns a getter for testing if the specific product is active - * + * * A cache object can be passed in, so if you need to call this multiple times, the cache * can be re-used to avoid having to enumerate schemas to calculate knownTypes and groups * if required @@ -1369,12 +1369,12 @@ export const getters = { // Return a named function so that we can trace it in the browser performance log return function isProductActive(productOrId, previousCache) { // Use the supplied cache object if there is one, otherwise a new local object - let cache = previousCache || {}; - + const cache = previousCache || {}; + if (!cache.knownTypes) { cache.knownTypes = {}; } - + if (!cache.knownGroups) { cache.knownGroups = {}; } @@ -1388,6 +1388,7 @@ export const getters = { } const module = p.inStore; + const isDev = rootGetters['prefs/get'](VIEW_IN_API); if ( !p.public && !isDev ) { return false; @@ -1427,7 +1428,7 @@ export const getters = { } if (p.ifHave && !ifHave(rootGetters, p.ifHave)) { - return false; + return false; } if (p.ifHaveType) { @@ -1458,7 +1459,7 @@ export const getters = { return; } - let cache = {}; + const cache = {}; return state.products.filter((p) => getters['isProductActive'](p, cache)); }, @@ -1470,7 +1471,7 @@ export const getters = { return; } - let cache = {}; + const cache = {}; return state.products.filter((p) => !p.rootProduct || p.rootProduct === p.name).filter((p) => getters['isProductActive'](p, cache)); },