diff --git a/src/pages/GameSelectionScreen.vue b/src/pages/GameSelectionScreen.vue index cbe93579d..2fb4bd95e 100644 --- a/src/pages/GameSelectionScreen.vue +++ b/src/pages/GameSelectionScreen.vue @@ -327,6 +327,8 @@ export default class GameSelectionScreen extends Vue { await this.$store.dispatch('checkMigrations'); this.runningMigration = false; + await this.$store.dispatch('resetLocalState'); + this.settings = await ManagerSettings.getSingleton(GameManager.defaultGame); const globalSettings = this.settings.getContext().global; this.favourites = globalSettings.favouriteGames || []; diff --git a/src/store/index.ts b/src/store/index.ts index d86bd0637..f3c69dd19 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -68,7 +68,15 @@ export const store = { const settings = await ManagerSettings.getSingleton(game); commit('setSettings', settings); return settings; - } + }, + + async resetLocalState({commit, dispatch}: Context) { + commit('profile/reset'); + commit('profiles/reset'); + commit('tsMods/reset'); + commit('modFilters/reset'); + await dispatch('resetActiveGame'); + }, }, mutations: { setActiveGame(state: State, game: Game) { diff --git a/src/store/modules/ModFilterModule.ts b/src/store/modules/ModFilterModule.ts index 8f6369a4e..16139696b 100644 --- a/src/store/modules/ModFilterModule.ts +++ b/src/store/modules/ModFilterModule.ts @@ -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, diff --git a/src/store/modules/ProfileModule.ts b/src/store/modules/ProfileModule.ts index be991c824..724e3975e 100644 --- a/src/store/modules/ProfileModule.ts +++ b/src/store/modules/ProfileModule.ts @@ -119,6 +119,15 @@ export default { }, mutations: { + reset(state: State) { + state.modList = []; + state.order = undefined; + state.direction = undefined; + state.disabledPosition = undefined; + state.searchQuery = ''; + state.dismissedUpdateAll = false; + }, + dismissUpdateAll(state: State) { state.dismissedUpdateAll = true; }, diff --git a/src/store/modules/ProfilesModule.ts b/src/store/modules/ProfilesModule.ts index 265b79d3e..9c1ba82b8 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 addProfile({rootGetters, state, dispatch}, name: string) { diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 6396e8aae..e07438eb7 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(); },