File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,13 @@ export default function SearchPage() {
5656 const [ isJpnArtistModalOpen , setIsJpnArtistModalOpen ] = useState ( false ) ;
5757 const [ isFocusAuto , setIsFocusAuto ] = useState ( false ) ;
5858
59- const { ref, inView } = useInView ( ) ;
59+ const [ scrollRef , setScrollRef ] = useState < HTMLDivElement | null > ( null ) ;
60+ const { ref, inView } = useInView ( {
61+ root : scrollRef ,
62+ rootMargin : '0px 0px 800px 0px' , // 스크롤 하단 600px 이전에 미리 로딩
63+ } ) ;
64+
65+ console . log ( 'inView' , inView ) ;
6066
6167 const { guestToSingSongs } = useGuestToSingStore ( ) ;
6268
@@ -178,7 +184,7 @@ export default function SearchPage() {
178184 { /* 검색 기록 */ }
179185 < SearchHistory onHistoryClick = { handleHistoryClick } />
180186 </ div >
181- < div className = "h-[calc(100vh-24rem)] overflow-x-hidden overflow-y-auto" >
187+ < div ref = { setScrollRef } className = "h-[calc(100vh-24rem)] overflow-x-hidden overflow-y-auto" >
182188 { searchSongs . length > 0 && (
183189 < div className = "flex w-full max-w-md flex-col gap-4 p-4" >
184190 { searchSongs . map ( ( song , index ) => (
Original file line number Diff line number Diff line change 11'use client' ;
22
33import { UserRoundSearch } from 'lucide-react' ;
4- import { useState } from 'react' ;
54
65import { Button } from '@/components/ui/button' ;
76import {
You can’t perform that action at this time.
0 commit comments