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:
@ -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,
|
||||
]
|
||||
|
Reference in New Issue
Block a user