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 <ShowTasks
v-if="hasLists" v-if="hasLists"
class="mt-4" class="mt-4"
:show-all="true"
:key="showTasksKey" :key="showTasksKey"
/> />
</div> </div>

View file

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