From 7fa94a9bd525439c1893c36f209ce5bf2649b697 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 10 Jul 2021 12:45:36 +0200 Subject: [PATCH] Fix loading a list when it was already partially saved in vuex --- src/store/index.js | 2 +- src/views/list/ShowList.vue | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index ef235f649..df24ccd06 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -116,7 +116,7 @@ export const store = new Vuex.Store({ // Server updates don't return the right. Therefore the right is reset after updating the list which is // confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right // when updating the list in global state. - if (typeof state.currentList.maxRight !== 'undefined') { + if (typeof state.currentList.maxRight !== 'undefined' && (typeof currentList.maxRight === 'undefined' || currentList.maxRight === null)) { currentList.maxRight = state.currentList.maxRight } state.currentList = currentList diff --git a/src/views/list/ShowList.vue b/src/views/list/ShowList.vue index 086e0bcdd..a3b4ee616 100644 --- a/src/views/list/ShowList.vue +++ b/src/views/list/ShowList.vue @@ -89,7 +89,7 @@ export default { return }, loadList() { - if(this.$route.name.includes('.settings.')) { + if (this.$route.name.includes('.settings.')) { return } @@ -116,12 +116,16 @@ export default { return this.replaceListView() } - // Don't load the list if we either already loaded it or aren't dealing with a list at all currently + // Don't load the list if we either already loaded it or aren't dealing with a list at all currently and + // the currently loaded list has the right set. if ( - this.$route.params.listId === this.listLoaded || - typeof this.$route.params.listId === 'undefined' || - this.$route.params.listId === this.currentList.id || - parseInt(this.$route.params.listId) === this.currentList.id + ( + this.$route.params.listId === this.listLoaded || + typeof this.$route.params.listId === 'undefined' || + this.$route.params.listId === this.currentList.id || + parseInt(this.$route.params.listId) === this.currentList.id + ) + && typeof this.currentList !== 'undefined' && this.currentList.maxRight !== null ) { return }