diff --git a/client/src/pages/dashboard/components/DashboardHeader/components/DashboardFilters.tsx b/client/src/pages/dashboard/components/DashboardHeader/components/DashboardFilters.tsx index d54eb23..e6232a9 100644 --- a/client/src/pages/dashboard/components/DashboardHeader/components/DashboardFilters.tsx +++ b/client/src/pages/dashboard/components/DashboardHeader/components/DashboardFilters.tsx @@ -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],