client-app/app/components/env-tab.js in logster-2.6.1 vs client-app/app/components/env-tab.js in logster-2.6.2

- old
+ new

@@ -1,8 +1,8 @@ import Component from "@ember/component"; import { computed } from "@ember/object"; -import { buildHashString } from "client-app/lib/utilities"; +import { buildHashString, clone } from "client-app/lib/utilities"; import Preload from "client-app/lib/preload"; export default Component.extend({ currentEnv: computed("isEnvArray", "currentEnvPosition", function() { if (this.isEnvArray) { @@ -18,31 +18,23 @@ html: computed("isEnvArray", "currentEnv", "expanded.[]", function() { if (!this.isEnvArray) { return buildHashString(this.get("message.env")); } else { + const currentEnv = clone(this.currentEnv); const expandableKeys = Preload.get("env_expandable_keys") || []; - const expandedLists = {}; expandableKeys.forEach(key => { - if ( - Object.prototype.hasOwnProperty.call(this.currentEnv, key) && - !Array.isArray(this.currentEnv[key]) - ) { - const list = [this.currentEnv[key]]; + if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) { + const list = [currentEnv[key]]; this.message.env.forEach(env => { if (env[key] && list.indexOf(env[key]) === -1) { list.push(env[key]); } }); - expandedLists[key] = list; + currentEnv[key] = list.length > 1 ? list : list[0]; } }); - return buildHashString( - this.currentEnv, - false, - this.expanded, - expandedLists - ); + return buildHashString(currentEnv, false, this.expanded || []); } }), click(e) { const elem = e.target;