diff --git a/src/components/lists/ShowList.vue b/src/components/lists/ShowList.vue index 6efbc0647..b713dac51 100644 --- a/src/components/lists/ShowList.vue +++ b/src/components/lists/ShowList.vue @@ -68,7 +68,10 @@ this.$route.name !== 'list.table' && this.$route.name !== 'list.kanban' ) { - router.replace({name: 'list.list', params: {id: this.$route.params.listId}}) + + const savedListView = localStorage.getItem('listView') + + router.replace({name: savedListView ? savedListView : 'list.list', params: {id: this.$route.params.listId}}) return } diff --git a/src/components/lists/views/Gantt.vue b/src/components/lists/views/Gantt.vue index c7d0d42dc..d0a170f91 100644 --- a/src/components/lists/views/Gantt.vue +++ b/src/components/lists/views/Gantt.vue @@ -71,6 +71,11 @@ flatPickr, GanttChart }, + created() { + // Save the current list view to local storage + // We use local storage and not vuex here to make it persistent across reloads. + localStorage.setItem('listView', this.$route.name) + }, data() { return { showTaskswithoutDates: false, diff --git a/src/components/lists/views/Kanban.vue b/src/components/lists/views/Kanban.vue index 626a6fc4b..e71868d3d 100644 --- a/src/components/lists/views/Kanban.vue +++ b/src/components/lists/views/Kanban.vue @@ -237,6 +237,13 @@ this.taskService = new TaskService() this.loadBuckets() setTimeout(() => document.addEventListener('click', this.closeBucketDropdowns), 0) + + // Save the current list view to local storage + // We use local storage and not vuex here to make it persistent across reloads. + localStorage.setItem('listView', this.$route.name) + }, + watch: { + '$route.params.listId': 'loadBuckets', }, computed: mapState({ buckets: state => state.kanban.buckets, diff --git a/src/components/lists/views/List.vue b/src/components/lists/views/List.vue index 46e2c8772..6c86e505c 100644 --- a/src/components/lists/views/List.vue +++ b/src/components/lists/views/List.vue @@ -136,6 +136,10 @@ }, created() { this.taskService = new TaskService() + + // Save the current list view to local storage + // We use local storage and not vuex here to make it persistent across reloads. + localStorage.setItem('listView', this.$route.name) }, methods: { // This function initializes the tasks page and loads the first page of tasks diff --git a/src/components/lists/views/Table.vue b/src/components/lists/views/Table.vue index 87bb1c14e..4c1c117ee 100644 --- a/src/components/lists/views/Table.vue +++ b/src/components/lists/views/Table.vue @@ -202,6 +202,10 @@ } this.initTasks(1) + + // Save the current list view to local storage + // We use local storage and not vuex here to make it persistent across reloads. + localStorage.setItem('listView', this.$route.name) }, methods: { initTasks(page, search = '') {