From d9361bcd53b251591a7cf0e25af7acdd2f8ce1b7 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 29 Jul 2020 13:02:46 +0200 Subject: [PATCH] Redirect to current list view on click on list in menu again Fixes #196 --- src/views/list/ShowList.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/views/list/ShowList.vue b/src/views/list/ShowList.vue index 0791c022a..8f74730e0 100644 --- a/src/views/list/ShowList.vue +++ b/src/views/list/ShowList.vue @@ -74,6 +74,12 @@ }, }, methods: { + replaceListView() { + const savedListView = getListView(this.$route.params.listId) + router.replace({name: savedListView, params: {id: this.$route.params.listId}}) + console.debug('Replaced list view with ', savedListView) + return + }, loadList() { this.setTitle(this.currentList.title) @@ -88,6 +94,12 @@ this.$store.commit('kanban/setListId', 0) } + // When clicking again on a list in the menu, there would be no list view selected which means no list + // at all. Users will then have to click on the list view menu again which is quite confusing. + if (this.$route.name === 'list.index') { + return this.replaceListView() + } + // Don't load the list if we either already loaded it or aren't dealing with a list at all currently if ( this.$route.params.listId === this.listLoaded || @@ -105,11 +117,7 @@ this.$route.name !== 'list.table' && this.$route.name !== 'list.kanban' ) { - const savedListView = getListView(this.$route.params.listId) - - router.replace({name: savedListView, params: {id: this.$route.params.listId}}) - console.debug('Replaced list view with ', savedListView) - return + return this.replaceListView() } console.debug(`Loading list, $route.name = ${this.$route.name}, $route.params =`, this.$route.params, `, listLoaded = ${this.listLoaded}, currentList = `, this.currentList)