From 2bae8e95e581bdc29a1751adb1388cb405e9fd5d Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 8 Sep 2021 19:36:55 +0200 Subject: [PATCH] Fix task attributes overridden when saving the task title with enter --- src/components/tasks/partials/heading.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/tasks/partials/heading.vue b/src/components/tasks/partials/heading.vue index 841751ee6..d96769559 100644 --- a/src/components/tasks/partials/heading.vue +++ b/src/components/tasks/partials/heading.vue @@ -32,7 +32,7 @@ export default { name: 'heading', data() { return { - task: {title: '', identifier: '', index:''}, + task: {title: '', identifier: '', index: ''}, taskTitle: '', saved: false, saving: false, // Since loading is global state, this variable ensures we're only showing the saving icon when saving the description. @@ -79,6 +79,13 @@ export default { } }, saveTask() { + // When only saving with enter, the focusout event is called as well. This then leads to the saveTask + // method being called twice, overriding some task attributes in the second run. + // If we simply check if we're already in the process of saving, we can prevent that. + if (this.saving) { + return + } + this.saving = true this.$store.dispatch('tasks/update', this.task)