Skip to content

Commit

Permalink
🐛 fix: 로딩 에러로 인해 useInfiniteQuery로 다시 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
baegyeong committed Dec 5, 2024
1 parent daf0b42 commit e64a01d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { useInfiniteQuery } from '@tanstack/react-query';
import {
StockTimeSeriesResponseSchema,
type StockTimeSeriesRequest,
Expand All @@ -25,7 +25,7 @@ export const useGetStocksPriceSeries = ({
lastStartTime,
timeunit,
}: StockTimeSeriesRequest) => {
return useSuspenseInfiniteQuery({
return useInfiniteQuery({
queryKey: ['stocksTimeSeries', stockId, timeunit],
queryFn: ({ pageParam }) =>
getStocksPriceSeries({
Expand Down
7 changes: 3 additions & 4 deletions packages/frontend/src/pages/stock-detail/TradingChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<StockTimeSeriesRequest['timeunit']>('day');
Expand All @@ -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(
Expand Down Expand Up @@ -73,5 +74,3 @@ const TradingChart = () => {
</div>
);
};

export default TradingChart;

0 comments on commit e64a01d

Please sign in to comment.