fix: vuex mutation error in edit list #813
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#813
Loading…
Reference in New Issue
No description provided.
Delete Branch "dpschen/frontend:feature/fix-mutation-error-in-edit-list"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -107,4 +105,2 @@
this.listService.get(list)
.then(r => {
this.$set(this, 'list', r)
this.$store.commit(CURRENT_LIST, r)
By settings the return value of listService to the store the list in the store was identical to
this.list
.Because of that a change of e.g. list.title throws a vuex mutation error because it changes the title of that bucket in the store.
Ohh really nice catch
@ -117,6 +113,8 @@ export default {
save() {
this.$store.dispatch('lists/updateList', this.list)
.then(() => {
this.$store.commit(CURRENT_LIST, this.list)
Since we don't want to change the store value until we are finished I commit the changed value only in the save function and only if the updateList was successfull.
Now that I think of it again, I'm not sure if that makes sense. But it seems to work! :P And in the vue3 branch it removes the mutation error (I didn't check this pull request, waiting for the pipeline here).
Thanks!