From a463959a365a5d618a79c96a26f6506e700d6ea3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 1 Oct 2020 01:43:07 +0300 Subject: Initial work on highlighting changed settings. Some refactoring to simplify addition of new settings --- src/modules/config.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/modules/config.js') diff --git a/src/modules/config.js b/src/modules/config.js index 409d77a4..2c1e881f 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -74,18 +74,24 @@ export const instanceDefaultProperties = Object.entries(defaultState) .map(([key, value]) => key) const config = { - state: defaultState, + state: { ...defaultState }, getters: { - mergedConfig (state, getters, rootState, rootGetters) { + defaultConfig (state, getters, rootState, rootGetters) { const { instance } = rootState + console.log('DC', instance.minimalScopesMode) + return { + ...defaultState, + ...Object.fromEntries( + instanceDefaultProperties.map(key => [key, instance[key]]) + ) + } + }, + mergedConfig (state, getters, rootState, rootGetters) { + const { defaultConfig } = rootGetters + console.log('DC2', defaultConfig.hideISP) return { - ...state, - ...instanceDefaultProperties - .map(key => [key, state[key] === undefined - ? instance[key] - : state[key] - ]) - .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}) + ...defaultConfig, + ...state } } }, -- cgit v1.2.3-70-g09d2