fix: task sorting by position in list view

Resolves https://kolaente.dev/vikunja/frontend/issues/2119
This commit is contained in:
kolaente 2022-07-13 16:24:50 +02:00
parent 4a8b7a726a
commit 99a5afc817
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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,