1
0

fix(project): make sure the correct tasks are loaded when switching between projects

Resolves https://community.vikunja.io/t/filter-table-view-not-sorting/1416/3
This commit is contained in:
kolaente
2023-06-28 14:38:10 +02:00
parent 66bad4b2b1
commit ac6c4cf2bc
3 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import {ref, shallowReactive, watch, computed, type ShallowReactive} from 'vue'
import {ref, shallowReactive, watch, computed, type ComputedGetter} from 'vue'
import {useRoute} from 'vue-router'
import TaskCollectionService from '@/services/taskCollection'
@ -61,7 +61,10 @@ const SORT_BY_DEFAULT: SortBy = {
/**
* This mixin provides a base set of methods and properties to get tasks.
*/
export function useTaskList(projectId: ShallowReactive<IProject['id']>, sortByDefault: SortBy = SORT_BY_DEFAULT) {
export function useTaskList(projectIdGetter: ComputedGetter<IProject['id']>, sortByDefault: SortBy = SORT_BY_DEFAULT) {
const projectId = computed(() => projectIdGetter())
const params = ref({...getDefaultParams()})
const search = ref('')
@ -69,8 +72,6 @@ export function useTaskList(projectId: ShallowReactive<IProject['id']>, sortByDe
const sortBy = ref({ ...sortByDefault })
const getAllTasksParams = computed(() => {
let loadParams = {...params.value}
@ -81,7 +82,7 @@ export function useTaskList(projectId: ShallowReactive<IProject['id']>, sortByDe
loadParams = formatSortOrder(sortBy.value, loadParams)
return [
{projectId: projectId},
{projectId: projectId.value},
loadParams,
page.value || 1,
]