diff --git a/src/components/profiles-modals/DeleteProfileModal.vue b/src/components/profiles-modals/DeleteProfileModal.vue index 467371005..4fd8abea3 100644 --- a/src/components/profiles-modals/DeleteProfileModal.vue +++ b/src/components/profiles-modals/DeleteProfileModal.vue @@ -23,7 +23,7 @@ export default class DeleteProfileModal extends Vue { try { await this.$store.dispatch('profiles/removeSelectedProfile'); } catch (e) { - const err = R2Error.fromThrownValue(e, 'Error whilst deleting profile with DeleteProfileModal'); + const err = R2Error.fromThrownValue(e, 'Error whilst deleting profile'); this.$store.commit('error/handleError', err); } this.closeDeleteProfileModal(); diff --git a/src/store/modules/ProfilesModule.ts b/src/store/modules/ProfilesModule.ts index 1786632d0..79824c465 100644 --- a/src/store/modules/ProfilesModule.ts +++ b/src/store/modules/ProfilesModule.ts @@ -36,9 +36,16 @@ export const ProfilesModule = { throw R2Error.fromThrownValue(e, 'Error whilst deleting profile from disk'); } - if (profileName.toLowerCase() !== 'default') { - state.profileList = state.profileList.filter((p: string) => p !== profileName) - await dispatch('profile/updateActiveProfile', 'Default', { root: true }); + state.profileList = state.profileList.filter((p: string) => p !== profileName ||p === 'Default') + await dispatch('setSelectedProfile', { profileName: 'Default', prewarmCache: true }); + }, + + async setSelectedProfile({rootGetters, state, dispatch}, params: { profileName: string, prewarmCache: boolean }) { + await dispatch('profile/updateActiveProfile', params.profileName, { root: true }); + + if (params.prewarmCache) { + await dispatch('profile/updateModListFromFile', null, { root: true }); + await dispatch('tsMods/prewarmCache', null, { root: true }); } }, },