From 95efcf1ca77e07e43401ad119bbb15ef3b3ffcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Dombya?= <135591453+hervedombya@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:28:06 +0100 Subject: [PATCH] Refactor MetricTimespanProvider to use useLocation for improved location handling --- .../components/linetemporalchart/MetricTimespanProvider.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/components/linetemporalchart/MetricTimespanProvider.tsx b/src/lib/components/linetemporalchart/MetricTimespanProvider.tsx index 25751fff64..f815be05bc 100644 --- a/src/lib/components/linetemporalchart/MetricTimespanProvider.tsx +++ b/src/lib/components/linetemporalchart/MetricTimespanProvider.tsx @@ -1,12 +1,13 @@ import { createContext, useContext, useEffect, useState } from 'react'; import { QueryTimeSpan, queryTimeSpansCodes } from '../constants'; +import { useLocation } from 'react-router-dom'; export const MetricsTimeSpanContext = createContext(null); export const MetricsTimeSpanProvider = ({ children, location, }: { children: JSX.Element; - location?: Location; + location?: ReturnType; }) => { // the default timespan is the last 24h const [queryTimeSpanCode, setQueryTimeSpanCode] = useState(