feat: add date math for filters #1342

Merged
konrad merged 88 commits from feature/date-math into main 2022-03-28 17:30:43 +00:00
1 changed files with 2 additions and 7 deletions
Showing only changes of commit 4ac7d6b9df - Show all commits

View File

@ -115,11 +115,6 @@ function emitChanged() {
})
}
function inputChanged() {
flatpickrRange.value = ''
emitChanged()
}
watch(
() => flatpickrRange.value,
konrad marked this conversation as resolved Outdated

Why do we need to reset this every time?

Why do we need to reset this every time?

I don't think we have to. I've checked and it looks like this doesn't really break anything so I've removed it. Lets us get rid of inputChanged.

I don't think we have to. I've checked and it looks like this doesn't really break anything so I've removed it. Lets us get rid of `inputChanged`.
(newVal: string | null) => {

Called here!

Called here!
@ -139,8 +134,8 @@ watch(
emitChanged()
},
)
watch(() => from.value, inputChanged)
watch(() => to.value, inputChanged)
watch(() => from.value, emitChanged)
watch(() => to.value, emitChanged)

This is triggered three times!

Once for each of these lines:

from.value = fromDate
to.value = toDate

in the called function inputChanged of the watcher.
And then here again.

This is triggered three times! Once for each of these lines: ```js from.value = fromDate to.value = toDate ``` in the called function inputChanged of the watcher. And then here again.

mhh how can we fix this? Using a debounce to prevent it getting called three times if it changed all values at once? Or removing the watchers again?

It looks like the tasks are only loaded once, not three times. Maybe that's already enough?

mhh how can we fix this? Using a debounce to prevent it getting called three times if it changed all values at once? Or removing the watchers again? It looks like the tasks are only loaded once, not three times. Maybe that's already enough?
function setDateRange(range: string[] | null) {
if (range === null) {