From 7f4c14ea40552ef0e394be245521edfc7439c913 Mon Sep 17 00:00:00 2001 From: VilppeRiskidev Date: Thu, 7 Nov 2024 13:47:02 +0200 Subject: [PATCH 1/4] Disable Delete button in DeleteProfileModal when deleting is in progress --- src/components/profiles-modals/DeleteProfileModal.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/profiles-modals/DeleteProfileModal.vue b/src/components/profiles-modals/DeleteProfileModal.vue index d4f2dfc08..40f20f1bb 100644 --- a/src/components/profiles-modals/DeleteProfileModal.vue +++ b/src/components/profiles-modals/DeleteProfileModal.vue @@ -8,16 +8,20 @@ import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue"; components: {ModalCard} }) export default class DeleteProfileModal extends ProfilesMixin { + private deletingInProgress: boolean = false; + get isOpen(): boolean { return this.$store.state.modals.isDeleteProfileModalOpen; } closeDeleteProfileModal() { + this.deletingInProgress = false; this.$store.commit('closeDeleteProfileModal'); } async removeProfile() { try { + this.deletingInProgress = true; await this.$store.dispatch('profiles/removeSelectedProfile'); } catch (e) { const err = R2Error.fromThrownValue(e, 'Error whilst deleting profile'); @@ -41,6 +45,7 @@ export default class DeleteProfileModal extends ProfilesMixin { From 971b048bfceda7231aa4bb761b08c0b3b00ee4ec Mon Sep 17 00:00:00 2001 From: Vili Manninen Date: Sun, 10 Nov 2024 21:41:59 +0200 Subject: [PATCH 4/4] Add check at the start of profile handling functions to prevent multiple attempts at the same time --- src/components/profiles-modals/CreateProfileModal.vue | 3 +++ src/components/profiles-modals/DeleteProfileModal.vue | 3 +++ src/components/profiles-modals/RenameProfileModal.vue | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/components/profiles-modals/CreateProfileModal.vue b/src/components/profiles-modals/CreateProfileModal.vue index ac00bccef..f8e696801 100644 --- a/src/components/profiles-modals/CreateProfileModal.vue +++ b/src/components/profiles-modals/CreateProfileModal.vue @@ -24,6 +24,9 @@ export default class CreateProfileModal extends ProfilesMixin { // User confirmed creation of a new profile with a name that didn't exist before. async createProfile() { + if (this.creatingInProgress) { + return; + } const safeName = this.makeProfileNameSafe(this.newProfileName); if (safeName !== '') { try { diff --git a/src/components/profiles-modals/DeleteProfileModal.vue b/src/components/profiles-modals/DeleteProfileModal.vue index 40f20f1bb..b0080afca 100644 --- a/src/components/profiles-modals/DeleteProfileModal.vue +++ b/src/components/profiles-modals/DeleteProfileModal.vue @@ -20,6 +20,9 @@ export default class DeleteProfileModal extends ProfilesMixin { } async removeProfile() { + if (this.deletingInProgress) { + return; + } try { this.deletingInProgress = true; await this.$store.dispatch('profiles/removeSelectedProfile'); diff --git a/src/components/profiles-modals/RenameProfileModal.vue b/src/components/profiles-modals/RenameProfileModal.vue index af6b03db5..8c40ce2de 100644 --- a/src/components/profiles-modals/RenameProfileModal.vue +++ b/src/components/profiles-modals/RenameProfileModal.vue @@ -48,6 +48,9 @@ export default class RenameProfileModal extends ProfilesMixin { } async performRename() { + if (this.renamingInProgress) { + return; + } try { this.renamingInProgress = true; await this.$store.dispatch('profiles/renameProfile', {newName: this.newProfileName});