feat: only use one watcher

This commit is contained in:
kolaente 2022-08-02 13:53:17 +02:00
parent f5c7b5be82
commit 5dac96a2d5
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -54,7 +54,7 @@
</template>
<script setup lang="ts">
import {computed, nextTick, ref, watch} from 'vue'
import {computed, nextTick, ref, watch, watchEffect} from 'vue'
import TaskCollectionService from '@/services/taskCollection'
import TaskService from '@/services/task'
import {format, parse} from 'date-fns'
@ -174,11 +174,11 @@ async function loadTasks() {
mapGanttBars()
}
loadTasks()
watch(() => props.dateTo, loadTasks)
watch(() => props.dateFrom, loadTasks)
watch(() => props.showTasksWithoutDates, loadTasks)
watchEffect(() => loadTasks({
dateTo: props.dateTo,
dateFrom: props.dateFrom,
showTasksWithoutDates: props.showTasksWithoutDates,
}))
async function updateTask(e) {
const task = tasks.value.get(e.bar.ganttBarConfig.id)