feat: save current list view just once

This commit is contained in:
Dominik Pschenitschni 2021-11-14 21:34:34 +01:00
parent 7eed0628d0
commit 29a9335844
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
5 changed files with 6 additions and 28 deletions

View file

@ -66,7 +66,6 @@
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
import flatPickr from 'vue-flatpickr-component' import flatPickr from 'vue-flatpickr-component'
import { i18n } from '@/i18n' import { i18n } from '@/i18n'
@ -76,13 +75,6 @@ import ListWrapper from './ListWrapper'
import GanttChart from '@/components/tasks/gantt-component' import GanttChart from '@/components/tasks/gantt-component'
import Fancycheckbox from '@/components/input/fancycheckbox' import Fancycheckbox from '@/components/input/fancycheckbox'
import {saveListView} from '@/helpers/saveListView'
const route = useRoute()
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
saveListView(route.params.listId, route.name)
const showTaskswithoutDates = ref(false) const showTaskswithoutDates = ref(false)
const dayWidth = ref(35) const dayWidth = ref(35)
const dateFrom = ref(new Date((new Date()).setDate((new Date()).getDate() - 15))) const dateFrom = ref(new Date((new Date()).setDate((new Date()).getDate() - 15)))

View file

@ -234,7 +234,6 @@ import cloneDeep from 'lodash.clonedeep'
import BucketModel from '../../models/bucket' import BucketModel from '../../models/bucket'
import {mapState} from 'vuex' import {mapState} from 'vuex'
import {saveListView} from '@/helpers/saveListView'
import Rights from '../../models/constants/rights.json' import Rights from '../../models/constants/rights.json'
import {LOADING, LOADING_MODULE} from '@/store/mutation-types' import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
import ListWrapper from './ListWrapper' import ListWrapper from './ListWrapper'
@ -299,11 +298,6 @@ export default {
} }
}, },
created() {
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
saveListView(this.$route.params.listId, this.$route.name)
},
watch: { watch: {
loadBucketParameter: { loadBucketParameter: {
handler: 'loadBuckets', handler: 'loadBuckets',

View file

@ -133,14 +133,12 @@
<script> <script>
import { ref } from 'vue' import { ref } from 'vue'
import { useRoute } from 'vue-router'
import ListWrapper from './ListWrapper' import ListWrapper from './ListWrapper'
import EditTask from '@/components/tasks/edit-task' import EditTask from '@/components/tasks/edit-task'
import AddTask from '@/components/tasks/add-task' import AddTask from '@/components/tasks/add-task'
import SingleTaskInList from '@/components/tasks/partials/singleTaskInList' import SingleTaskInList from '@/components/tasks/partials/singleTaskInList'
import { useTaskList } from '@/composables/taskList' import { useTaskList } from '@/composables/taskList'
import {saveListView} from '@/helpers/saveListView'
import Rights from '../../models/constants/rights.json' import Rights from '../../models/constants/rights.json'
import FilterPopup from '@/components/list/partials/filter-popup.vue' import FilterPopup from '@/components/list/partials/filter-popup.vue'
import {HAS_TASKS} from '@/store/mutation-types' import {HAS_TASKS} from '@/store/mutation-types'
@ -206,11 +204,6 @@ export default {
const taskList = useTaskList(beforeLoad) const taskList = useTaskList(beforeLoad)
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
const route = useRoute()
saveListView(route.params.listId, route.name)
taskList.initTaskList() taskList.initTaskList()
return { return {

View file

@ -184,7 +184,7 @@
<script setup> <script setup>
import { ref, reactive, computed, toRaw } from 'vue' import { ref, reactive, computed, toRaw } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter } from 'vue-router'
import ListWrapper from './ListWrapper' import ListWrapper from './ListWrapper'
import Done from '@/components/misc/Done.vue' import Done from '@/components/misc/Done.vue'
@ -199,7 +199,6 @@ import Pagination from '@/components/misc/pagination.vue'
import Popup from '@/components/misc/popup' import Popup from '@/components/misc/popup'
import { useTaskList } from '@/composables/taskList' import { useTaskList } from '@/composables/taskList'
import {saveListView} from '@/helpers/saveListView'
const ACTIVE_COLUMNS_DEFAULT = { const ACTIVE_COLUMNS_DEFAULT = {
id: true, id: true,
@ -288,11 +287,6 @@ const taskDetailRoutes = computed(() => Object.fromEntries(
])), ])),
)) ))
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
const route = useRoute()
saveListView(route.params.listId, route.name)
function sort(property) { function sort(property) {
const order = sortBy.value[property] const order = sortBy.value[property]
if (typeof order === 'undefined' || order === 'none') { if (typeof order === 'undefined' || order === 'none') {

View file

@ -59,11 +59,16 @@ import {store} from '@/store'
import {CURRENT_LIST} from '@/store/mutation-types' import {CURRENT_LIST} from '@/store/mutation-types'
import {getListTitle} from '@/helpers/getListTitle' import {getListTitle} from '@/helpers/getListTitle'
import {saveListView} from '@/helpers/saveListView'
import {saveListToHistory} from '@/modules/listHistory' import {saveListToHistory} from '@/modules/listHistory'
import { useTitle } from '@/composables/useTitle' import { useTitle } from '@/composables/useTitle'
const route = useRoute() const route = useRoute()
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
saveListView(route.params.listId, route.name)
const listService = shallowRef(new ListService()) const listService = shallowRef(new ListService())
const loadedListId = ref(0) const loadedListId = ref(0)