From e4d7790d6d786a24c2835591739c130388b37b93 Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Sun, 6 Jun 2021 18:31:09 +0100 Subject: [PATCH] Store/Settings: Remove unnecessary `updateInvidiousInstance` call The 'grabUserSettings' action calls the 'updateInvidiousInstance' action whenever the database returns an empty value for this setting. However, that scenario should never happen in the first place. In addition, a default value is already provided directly in the state. --- src/renderer/store/modules/settings.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js index 49d43b00..53121c86 100644 --- a/src/renderer/store/modules/settings.js +++ b/src/renderer/store/modules/settings.js @@ -171,7 +171,7 @@ Object.assign(getters, { // Custom actions Object.assign(actions, { // Add `grabUserSettings` to actions - grabUserSettings: ({ dispatch, commit }) => { + grabUserSettings: ({ commit }) => { return new Promise((resolve, reject) => { settingsDb.find({}, (err, results) => { if (!err) { @@ -179,14 +179,7 @@ Object.assign(actions, { results.forEach((result) => { switch (result._id) { case 'invidiousInstance': - if (result.value === '') { - dispatch( - 'updateInvidiousInstance', - 'https://invidious.snopyta.org' - ) - } else { - commit('setInvidiousInstance', result.value) - } + commit('setInvidiousInstance', result.value) break case 'backendFallback': commit('setBackendFallback', result.value)