Skip to content

Commit

Permalink
Fix selecting Default Profile after deleting a Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
VilppeRiskidev committed May 24, 2024
1 parent 5794d5d commit cd8c2ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/profiles-modals/DeleteProfileModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 10 additions & 3 deletions src/store/modules/ProfilesModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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 });
}
},
},
Expand Down

0 comments on commit cd8c2ff

Please sign in to comment.