From 99a5afc817c65aa53dcafd5b5491ef9fb6202b3a Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 13 Jul 2022 16:24:50 +0200 Subject: [PATCH] fix: task sorting by position in list view Resolves https://kolaente.dev/vikunja/frontend/issues/2119 --- src/composables/taskList.ts | 7 +++---- src/views/list/ListList.vue | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/composables/taskList.ts b/src/composables/taskList.ts index 330f380e..0c6f09e2 100644 --- a/src/composables/taskList.ts +++ b/src/composables/taskList.ts @@ -1,4 +1,4 @@ -import { ref, shallowReactive, watch, computed } from 'vue' +import {ref, shallowReactive, watch, computed} from 'vue' import {useRoute} from 'vue-router' import TaskCollectionService from '@/services/taskCollection' @@ -20,14 +20,13 @@ const SORT_BY_DEFAULT = { /** * This mixin provides a base set of methods and properties to get tasks on a list. */ -export function useTaskList(listId) { +export function useTaskList(listId, sortByDefault = SORT_BY_DEFAULT) { const params = ref({...getDefaultParams()}) const search = ref('') const page = ref(1) - const sortBy = ref({ ...SORT_BY_DEFAULT }) - + const sortBy = ref({ ...sortByDefault }) // This makes sure an id sort order is always sorted last. // When tasks would be sorted first by id and then by whatever else was specified, the id sort takes diff --git a/src/views/list/ListList.vue b/src/views/list/ListList.vue index 1d60db0f..1555a3dd 100644 --- a/src/views/list/ListList.vue +++ b/src/views/list/ListList.vue @@ -214,7 +214,9 @@ export default defineComponent({ // isTaskEdit.value = false // } - const taskList = useTaskList(toRef(props, 'listId')) + const taskList = useTaskList(toRef(props, 'listId'), { + position: 'asc', + }) return { taskEditTask,