Fixed filters bug
This commit is contained in:
parent
722c9e777a
commit
9be5dc8281
|
|
@ -1,6 +1,7 @@
|
|||
import { DateTimeInput } from '@/components/DateTimeInput'
|
||||
import { useFilterIntervals } from '@/pages/dashboard/hooks/useFilterIntervals'
|
||||
import { intervalToRange } from '@/utils/intervalToRange'
|
||||
import { nextFrame } from '@/utils/nextFrame'
|
||||
import { useEffect, useState } from 'preact/hooks'
|
||||
import { useDashboardContext } from '../../../contexts/DashboardContext'
|
||||
|
||||
|
|
@ -41,11 +42,14 @@ export const DashboardFilters = ({ onClose }: Props) => {
|
|||
onClose?.()
|
||||
}
|
||||
|
||||
const setInterval = (interval: FilterInterval) => {
|
||||
const setInterval = async (interval: FilterInterval) => {
|
||||
const range = intervalToRange(interval, value.customFrom, value.customTo)
|
||||
|
||||
setValue({
|
||||
...value,
|
||||
// preact bug again - starting to regret using it
|
||||
await nextFrame()
|
||||
|
||||
setFilter({
|
||||
...preset,
|
||||
interval,
|
||||
customFrom: range[0],
|
||||
customTo: range[1],
|
||||
|
|
|
|||
Loading…
Reference in New Issue