diff --git a/src/pages/GameSelectionScreen.vue b/src/pages/GameSelectionScreen.vue index 19e47109..ec3450bb 100644 --- a/src/pages/GameSelectionScreen.vue +++ b/src/pages/GameSelectionScreen.vue @@ -326,7 +326,11 @@ export default class GameSelectionScreen extends Vue { await this.$store.dispatch('checkMigrations'); this.runningMigration = false; + await this.$store.dispatch('resetModFilterModule'); + await this.$store.dispatch('resetTsModsModule'); await this.$store.dispatch('resetProfileModule'); + await this.$store.dispatch('resetProfilesModule'); + this.settings = await ManagerSettings.getSingleton(GameManager.defaultGame); const globalSettings = this.settings.getContext().global; this.favourites = globalSettings.favouriteGames || []; diff --git a/src/pages/Profiles.vue b/src/pages/Profiles.vue index 64a3305b..b907fd57 100644 --- a/src/pages/Profiles.vue +++ b/src/pages/Profiles.vue @@ -616,6 +616,10 @@ export default class Profiles extends Vue { const settings = await this.$store.getters.settings; await settings.load(); + await this.$store.dispatch('resetModFilterModule'); + await this.$store.dispatch('resetTsModsModule'); + await this.$store.dispatch('resetProfileModule'); + const lastProfileName = await this.$store.dispatch('profile/loadLastSelectedProfile'); // If the view was entered via game selection, the mod list was updated diff --git a/src/store/index.ts b/src/store/index.ts index cb560032..be0125f0 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -70,9 +70,17 @@ export const store = { return settings; }, - // TODO: Add reset actions for other modules async resetProfileModule({dispatch}: Context) { return await dispatch('profile/reset'); + }, + async resetProfilesModule({dispatch}: Context) { + return await dispatch('profiles/reset'); + }, + async resetTsModsModule({dispatch}: Context) { + return await dispatch('tsMods/reset'); + }, + async resetModFilterModule({dispatch}: Context) { + return await dispatch('modFilters/reset'); } }, mutations: { diff --git a/src/store/modules/ModFilterModule.ts b/src/store/modules/ModFilterModule.ts index 8f6369a4..726af18d 100644 --- a/src/store/modules/ModFilterModule.ts +++ b/src/store/modules/ModFilterModule.ts @@ -1,4 +1,4 @@ -import { GetterTree } from 'vuex'; +import { ActionTree, GetterTree } from 'vuex'; import { State as RootState } from '../index'; @@ -11,7 +11,7 @@ interface State { } /** - * State for OnlineModList, i.e. list for all the mods available on Thunderstore. + * State for ModFilter, i.e. filters for mod listings. */ export default { namespaced: true, @@ -70,4 +70,10 @@ export default { state.showDeprecatedPackages = value; }, }, + + actions: >{ + async reset({commit}) { + commit('reset'); + } + } } diff --git a/src/store/modules/ProfileModule.ts b/src/store/modules/ProfileModule.ts index 4aa950c5..5cc97e4d 100644 --- a/src/store/modules/ProfileModule.ts +++ b/src/store/modules/ProfileModule.ts @@ -14,7 +14,6 @@ import ManagerSettings from '../../r2mm/manager/ManagerSettings'; import ModListSort from '../../r2mm/mods/ModListSort'; import ProfileModList from '../../r2mm/mods/ProfileModList'; import SearchUtils from '../../utils/SearchUtils'; -import GameManager from "../../model/game/GameManager"; interface State { activeProfile: Profile | null; diff --git a/src/store/modules/ProfilesModule.ts b/src/store/modules/ProfilesModule.ts index 000bf025..2da1efd0 100644 --- a/src/store/modules/ProfilesModule.ts +++ b/src/store/modules/ProfilesModule.ts @@ -23,6 +23,9 @@ export const ProfilesModule = { setProfileList(state: State, profileList: string[]) { state.profileList = profileList; }, + reset(state: State) { + state.profileList = ['Default']; + }, }, actions: >{ async removeSelectedProfile({rootGetters, state, dispatch}) { @@ -41,6 +44,10 @@ export const ProfilesModule = { await dispatch('setSelectedProfile', { profileName: 'Default', prewarmCache: true }); }, + async reset({commit}) { + commit('reset'); + }, + async setSelectedProfile({rootGetters, state, dispatch}, params: { profileName: string, prewarmCache: boolean }) { await dispatch('profile/updateActiveProfile', params.profileName, { root: true }); diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 6396e8aa..b2f24fdd 100644 --- a/src/store/modules/TsModsModule.ts +++ b/src/store/modules/TsModsModule.ts @@ -116,6 +116,14 @@ export const TsModsModule = { }, mutations: >{ + reset(state: State) { + state.cache = new Map(); + state.connectionError = ''; + state.deprecated = new Map(); + state.exclusions = []; + state.mods = []; + state.modsLastUpdated = undefined; + }, clearModCache(state) { state.cache.clear(); }, @@ -153,6 +161,10 @@ export const TsModsModule = { profileMods.forEach(getters['cachedMod']); }, + async reset({commit}) { + commit('reset'); + }, + async updateExclusions( {commit}, progressCallback?: (progress: number) => void