Skip to content

Commit 8d25d21

Browse files
authored
Merge pull request #149 from GulSam00/feat/artistAlias
hotfix : useInView에 rootMargin 지정
2 parents f292329 + 16f7983 commit 8d25d21

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

apps/web/src/app/search/HomePage.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff 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) => (

apps/web/src/app/search/JpnArtistList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client';
22

33
import { UserRoundSearch } from 'lucide-react';
4-
import { useState } from 'react';
54

65
import { Button } from '@/components/ui/button';
76
import {

0 commit comments

Comments
 (0)