Make sure to only show the loading spinner and saved message when saving the description

This commit is contained in:
kolaente 2020-11-22 16:35:58 +01:00
parent f685ffbb13
commit fde740784b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,7 @@
</span>
Description
<transition name="fade">
<span class="is-small is-inline-flex" v-if="loading">
<span class="is-small is-inline-flex" v-if="loading && saving">
<span class="loader is-inline-block mr-2"></span>
Saving...
</span>
@ -47,6 +47,7 @@ export default {
return {
task: {description: ''},
saved: false,
saving: false, // Since loading is global state, this variable ensures we're only showing the saving icon when saving the description.
}
},
computed: mapState({
@ -73,6 +74,8 @@ export default {
},
methods: {
save() {
this.saving = true
this.$store.dispatch('tasks/update', this.task)
.then(() => {
this.$emit('input', this.task)
@ -84,6 +87,9 @@ export default {
.catch(e => {
this.error(e, this)
})
.finally(() => {
this.saving = false
})
}
},
}