From b0c7806cb66774b0921b5aa75814c12329194c8c Mon Sep 17 00:00:00 2001 From: u1 Date: Wed, 7 Jan 2026 07:56:45 +0000 Subject: [PATCH] feat(chart): expose bucketSeconds meta --- apps/visualizer/src/features/chart/useChartData.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/visualizer/src/features/chart/useChartData.ts b/apps/visualizer/src/features/chart/useChartData.ts index 25d72a9..6795ddd 100644 --- a/apps/visualizer/src/features/chart/useChartData.ts +++ b/apps/visualizer/src/features/chart/useChartData.ts @@ -14,6 +14,7 @@ type Params = { type Result = { candles: Candle[]; indicators: ChartIndicators; + meta: { tf: string; bucketSeconds: number } | null; loading: boolean; error: string | null; refresh: () => Promise; @@ -22,6 +23,7 @@ type Result = { export function useChartData({ symbol, source, tf, limit, pollMs }: Params): Result { const [candles, setCandles] = useState([]); const [indicators, setIndicators] = useState({}); + const [meta, setMeta] = useState<{ tf: string; bucketSeconds: number } | null>(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const inFlight = useRef(false); @@ -34,6 +36,7 @@ export function useChartData({ symbol, source, tf, limit, pollMs }: Params): Res const res = await fetchChart({ symbol, source, tf, limit }); setCandles(res.candles); setIndicators(res.indicators); + setMeta(res.meta); setError(null); } catch (e: any) { setError(String(e?.message || e)); @@ -50,8 +53,7 @@ export function useChartData({ symbol, source, tf, limit, pollMs }: Params): Res useInterval(() => void fetchOnce(), pollMs); return useMemo( - () => ({ candles, indicators, loading, error, refresh: fetchOnce }), - [candles, indicators, loading, error, fetchOnce] + () => ({ candles, indicators, meta, loading, error, refresh: fetchOnce }), + [candles, indicators, meta, loading, error, fetchOnce] ); } -