Skip to content

Commit

Permalink
Chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
y-solb committed Jul 7, 2024
1 parent 1f7bbaa commit 3ea8625
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/containers/main/RecentPortfolioList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@

import PortfolioList from '@/components/portfolio/PortfolioList'
import { useInfinitePortfolioQuery } from '@/hooks/queries/portfolio'
import useInfiniteScroll from '@/hooks/useInfiniteScroll'
// import useInfiniteScroll from '@/hooks/useInfiniteScroll'
import { useMemo, useRef } from 'react'

function RecentPortfolioList() {
const { data, fetchNextPage, isFetchingNextPage, hasNextPage } =
useInfinitePortfolioQuery()
const { data, isFetchingNextPage } = useInfinitePortfolioQuery()

const portfolios = useMemo(() => {
return [...(data?.pages?.flatMap((page) => page.data) || [])]
}, [data])

const fetchMorePortfolio = () => {
if (!isFetchingNextPage && hasNextPage) {
fetchNextPage()
}
}
// const fetchMorePortfolio = () => {
// if (!isFetchingNextPage && hasNextPage) {
// fetchNextPage()
// }
// }
const loaderRef = useRef<HTMLDivElement>(null)

useInfiniteScroll(loaderRef, fetchMorePortfolio)
// useInfiniteScroll(loaderRef, fetchMorePortfolio)

return (
<PortfolioList
Expand Down

0 comments on commit 3ea8625

Please sign in to comment.