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.
This commit is contained in:
Emma 2022-10-18 11:50:40 -04:00 committed by GitHub
parent 2bf8691352
commit c26445a09d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -387,9 +387,14 @@ Object.assign(customGetters, {
const customActions = { const customActions = {
grabUserSettings: async ({ commit, dispatch, getters }) => { grabUserSettings: async ({ commit, dispatch, getters }) => {
try { 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) { for (const setting of userSettings) {
const { _id, value } = setting const [_id, value] = setting
if (getters.settingHasSideEffects(_id)) { if (getters.settingHasSideEffects(_id)) {
dispatch(defaultSideEffectsTriggerId(_id), value) dispatch(defaultSideEffectsTriggerId(_id), value)
} }