chore: remove showAll prop and make it a computed instead

This commit is contained in:
kolaente 2022-02-20 21:32:02 +01:00
parent 95d8cdffe4
commit 4ce9ac9c66
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 3 additions and 5 deletions

View file

@ -53,7 +53,6 @@
<ShowTasks
v-if="hasLists"
class="mt-4"
:show-all="true"
:key="showTasksKey"
/>
</div>

View file

@ -72,23 +72,22 @@ const showNothingToDo = ref<boolean>(false)
setTimeout(() => showNothingToDo.value = true, 100)
// NOTE: You MUST provide either dateFrom and dateTo OR showAll for the component to actually show tasks.
// Linting disabled because we explicitely enabled destructuring in vite's config, this will work.
// eslint-disable-next-line vue/no-setup-props-destructure
const {
dateFrom,
dateTo,
showAll = false,
showNulls = false,
showOverdue = false,
} = defineProps<{
dateFrom?: Date | string,
dateTo?: Date | string,
showAll?: Boolean,
showNulls?: Boolean,
showOverdue?: Boolean,
}>()
const showAll = computed(() => typeof dateFrom === 'undefined' || typeof dateTo === 'undefined')
const pageTitle = computed(() => {
let title = ''
@ -190,7 +189,7 @@ async function loadPendingTasks(from: string, to: string) {
filterIncludeNulls: showNulls,
}
if (!showAll) {
if (!showAll.value) {
params.filterBy.push('due_date')
params.filterValue.push(to)
params.filterComparator.push('less')