diff --git a/src/components/settings-components/SettingsView.vue b/src/components/settings-components/SettingsView.vue
index f8a9667c7..1791010bd 100644
--- a/src/components/settings-components/SettingsView.vue
+++ b/src/components/settings-components/SettingsView.vue
@@ -247,7 +247,7 @@ import UtilityMixin from '../mixins/UtilityMixin.vue';
'Update all mods',
'Quickly update every installed mod to their latest versions.',
async () => {
- const outdatedMods = ThunderstoreDownloaderProvider.instance.getLatestOfAllToUpdate(this.localModList, this.$store.state.thunderstoreModList);
+ const outdatedMods = this.$store.getters.localModsWithUpdates;
if (outdatedMods.length === 1) {
return "1 mod has an update available";
}
@@ -412,6 +412,5 @@ import UtilityMixin from '../mixins/UtilityMixin.vue';
doesLogFileExist() {
return this.logOutput.exists ? 'Log file exists' : 'Log file does not exist';
}
-
}
diff --git a/src/components/views/DownloadModModal.vue b/src/components/views/DownloadModModal.vue
index 07feafa10..7b9acc70d 100644
--- a/src/components/views/DownloadModModal.vue
+++ b/src/components/views/DownloadModModal.vue
@@ -81,7 +81,7 @@
The following mods will be downloaded and installed:
- -
{{key.getVersion().getName()}} will be updated to: {{key.getVersion().getVersionNumber().toString()}}
@@ -205,10 +205,6 @@ let assignId = 0;
return this.$store.state.thunderstoreModList || [];
}
- get localModList(): ManifestV2[] {
- return this.$store.state.localModList || [];
- }
-
@Watch('$store.state.modals.downloadModModalMod')
async getModVersions() {
this.currentVersion = null;
@@ -375,10 +371,6 @@ let assignId = 0;
}, 1);
}
- getListOfModsToUpdate(): ThunderstoreCombo[] {
- return ThunderstoreDownloaderProvider.instance.getLatestOfAllToUpdate(this.localModList, this.thunderstorePackages);
- }
-
static async installModAfterDownload(profile: Profile, mod: ThunderstoreMod, version: ThunderstoreVersion): Promise {
return new Promise(async (resolve, reject) => {
const manifestMod: ManifestV2 = new ManifestV2().fromThunderstoreMod(mod, version);
diff --git a/src/components/views/InstalledModView.vue b/src/components/views/InstalledModView.vue
index 140c5c8d0..edc65e0b6 100644
--- a/src/components/views/InstalledModView.vue
+++ b/src/components/views/InstalledModView.vue
@@ -60,10 +60,7 @@ export default class InstalledModView extends Vue {
}
get numberOfModsWithUpdates(): number {
- return ThunderstoreDownloaderProvider.instance.getLatestOfAllToUpdate(
- this.$store.state.localModList,
- this.$store.state.thunderstoreModList
- ).length;
+ return this.$store.getters.localModsWithUpdates.length;
}
};
diff --git a/src/store/index.ts b/src/store/index.ts
index 889c0404d..06f704a97 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -6,6 +6,7 @@ import ModFilterModule from './modules/ModFilterModule';
import { FolderMigration } from '../migrations/FolderMigration';
import ManifestV2 from '../model/ManifestV2';
import ThunderstoreMod from '../model/ThunderstoreMod';
+import ThunderstoreDownloaderProvider from "../providers/ror2/downloading/ThunderstoreDownloaderProvider";
import ThunderstorePackages from '../r2mm/data/ThunderstorePackages';
Vue.use(Vuex);
@@ -83,6 +84,14 @@ export const store = {
state.deprecatedMods = ThunderstorePackages.getDeprecatedPackageMap();
}
},
+ getters: {
+ localModsWithUpdates(state: State) {
+ return ThunderstoreDownloaderProvider.instance.getLatestOfAllToUpdate(
+ state.localModList,
+ state.thunderstoreModList
+ );
+ }
+ },
modules: {
modals: ModalsModule,
modFilters: ModFilterModule,