From e64a01dfdd5e677046b6e24d09b30e8dfd0e3e37 Mon Sep 17 00:00:00 2001 From: baegyeong Date: Thu, 5 Dec 2024 11:56:24 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EB=A1=9C=EB=94=A9=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=EB=A1=9C=20=EC=9D=B8=ED=95=B4=20useInfiniteQ?= =?UTF-8?q?uery=EB=A1=9C=20=EB=8B=A4=EC=8B=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/apis/queries/stocks/useGetStocksPriceSeries.ts | 4 ++-- packages/frontend/src/pages/stock-detail/TradingChart.tsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/apis/queries/stocks/useGetStocksPriceSeries.ts b/packages/frontend/src/apis/queries/stocks/useGetStocksPriceSeries.ts index 5bd4879..3d9c85b 100644 --- a/packages/frontend/src/apis/queries/stocks/useGetStocksPriceSeries.ts +++ b/packages/frontend/src/apis/queries/stocks/useGetStocksPriceSeries.ts @@ -1,4 +1,4 @@ -import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; +import { useInfiniteQuery } from '@tanstack/react-query'; import { StockTimeSeriesResponseSchema, type StockTimeSeriesRequest, @@ -25,7 +25,7 @@ export const useGetStocksPriceSeries = ({ lastStartTime, timeunit, }: StockTimeSeriesRequest) => { - return useSuspenseInfiniteQuery({ + return useInfiniteQuery({ queryKey: ['stocksTimeSeries', stockId, timeunit], queryFn: ({ pageParam }) => getStocksPriceSeries({ diff --git a/packages/frontend/src/pages/stock-detail/TradingChart.tsx b/packages/frontend/src/pages/stock-detail/TradingChart.tsx index e22017b..8b2b15d 100644 --- a/packages/frontend/src/pages/stock-detail/TradingChart.tsx +++ b/packages/frontend/src/pages/stock-detail/TradingChart.tsx @@ -10,7 +10,7 @@ import { } from '@/apis/queries/stocks'; import { TIME_UNIT } from '@/constants/timeUnit'; -const TradingChart = () => { +export const TradingChart = () => { const { stockId } = useParams(); const [timeunit, setTimeunit] = useState('day'); @@ -23,7 +23,8 @@ const TradingChart = () => { timeunit, }); - const { priceDtoList: priceData, volumeDtoList: volumeData } = data; + const { priceDtoList: priceData = [], volumeDtoList: volumeData = [] } = + data || {}; const chart = useChart({ priceData, volumeData, containerRef }); const fetchGraphData = useCallback( @@ -73,5 +74,3 @@ const TradingChart = () => { ); }; - -export default TradingChart;