From c26445a09d0322b7cbac00d8e627370de7778aaa Mon Sep 17 00:00:00 2001 From: Emma Date: Tue, 18 Oct 2022 11:50:40 -0400 Subject: [PATCH] Expanding the settings which are iterated in `grabUserSettings` (#2737) Previously, only settings which have a user defined value would be iterated on in this loop. Now, all settings that have a user defined value or that have side effects will be iterated. This is important because `currentLocale`'s side effect handler contains a call to `getRegionData`, and if this side effect handler is never called, the `Region for Trending` option in settings will never populate. --- src/renderer/store/modules/settings.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js index 04286b29..2a4231d8 100644 --- a/src/renderer/store/modules/settings.js +++ b/src/renderer/store/modules/settings.js @@ -387,9 +387,14 @@ Object.assign(customGetters, { const customActions = { grabUserSettings: async ({ commit, dispatch, getters }) => { try { - const userSettings = await DBSettingHandlers.find() + // Assigning default settings for settings that have side effects + const userSettings = Object.entries(Object.assign({}, + Object.fromEntries(Object.entries(stateWithSideEffects).map(([_id, { defaultValue }]) => { return [_id, defaultValue] })), + Object.fromEntries((await DBSettingHandlers.find()).map(({ _id, value }) => { return [_id, value] }))) + ) + for (const setting of userSettings) { - const { _id, value } = setting + const [_id, value] = setting if (getters.settingHasSideEffects(_id)) { dispatch(defaultSideEffectsTriggerId(_id), value) }