fix(filters): reload tasks silently when marking one done in the list
All checks were successful
continuous-integration/drone/push Build is passing

This fixes a UI issue where if a user had a filter set and marked the task done, it would not disappear, even though the filter does not match the done task anymore.
This commit is contained in:
kolaente 2024-07-18 15:51:03 +02:00
parent bea81f83f7
commit 526bd1f170
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 13 additions and 4 deletions

View File

@ -73,7 +73,7 @@
>
<template v-if="canWrite">
<span class="icon handle">
<Icon icon="grip-lines" />
<Icon icon="grip-lines"/>
</span>
</template>
</SingleTaskInProject>
@ -220,6 +220,13 @@ function updateTaskList(task: ITask) {
}
function updateTasks(updatedTask: ITask) {
if (props.projectId < 0) {
// In the case of a filter, we'll reload the filter in the background to avoid tasks which do
// not match the filter show up here
loadTasks(false)
return
}
for (const t in tasks.value) {
if (tasks.value[t].id === updatedTask.id) {
tasks.value[t] = updatedTask
@ -308,7 +315,7 @@ function prepareFiltersAndLoadTasks() {
.list-view {
padding-bottom: 1rem;
:deep(.card) {
margin-bottom: 0;
}

View File

@ -105,8 +105,10 @@ export function useTaskList(
const totalPages = computed(() => taskCollectionService.totalPages)
const tasks = ref<ITask[]>([])
async function loadTasks() {
tasks.value = []
async function loadTasks(resetBeforeLoad: boolean = true) {
if(resetBeforeLoad) {
tasks.value = []
}
try {
tasks.value = await taskCollectionService.getAll(...getAllTasksParams.value)
} catch (e) {