fix: 가상 스크롤 버그 수정

- searchSchedules 미정의 오류 수정 (setSearchTerm만 사용)
- Schedule.jsx 항목 간 여백 추가 (ITEM_HEIGHT 136px)
This commit is contained in:
caadiq 2026-01-10 09:40:40 +09:00
parent ad2d501c39
commit 043f8b465d
2 changed files with 7 additions and 18 deletions

View file

@ -345,15 +345,6 @@ function AdminSchedule() {
fetchSchedules();
}, [year, month]);
//
useEffect(() => {
if (isSearchMode && searchTerm) {
searchSchedules(searchTerm);
}
}, []); //
//
useEffect(() => {
if (scrollContainerRef.current && scrollPosition > 0) {
@ -986,7 +977,6 @@ function AdminSchedule() {
onKeyDown={(e) => {
if (e.key === 'Enter') {
setSearchTerm(searchInput);
searchSchedules(searchInput);
} else if (e.key === 'Escape') {
setIsSearchMode(false);
setSearchInput('');
@ -999,7 +989,6 @@ function AdminSchedule() {
<button
onClick={() => {
setSearchTerm(searchInput);
searchSchedules(searchInput);
}}
disabled={searchLoading}
className="px-4 py-1.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50"

View file

@ -43,7 +43,7 @@ function Schedule() {
const [searchInput, setSearchInput] = useState('');
const [searchTerm, setSearchTerm] = useState('');
const SEARCH_LIMIT = 20; // 20
const ITEM_HEIGHT = 120; // (px)
const ITEM_HEIGHT = 136; // (120px) + (16px)
// Intersection Observer for infinite scroll
const { ref: loadMoreRef, inView } = useInView({
@ -721,7 +721,6 @@ function Schedule() {
onKeyDown={(e) => {
if (e.key === 'Enter') {
setSearchTerm(searchInput);
searchSchedules(searchInput);
} else if (e.key === 'Escape') {
setIsSearchMode(false);
setSearchInput('');
@ -735,7 +734,6 @@ function Schedule() {
<button
onClick={() => {
setSearchTerm(searchInput);
searchSchedules(searchInput);
}}
disabled={searchLoading}
className="px-4 py-1.5 bg-primary text-white text-sm font-medium rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50"
@ -861,10 +859,11 @@ function Schedule() {
transform: `translateY(${virtualItem.start}px)`,
}}
>
<div
onClick={() => handleScheduleClick(schedule)}
className="flex items-stretch bg-white rounded-2xl shadow-sm hover:shadow-md transition-shadow overflow-hidden cursor-pointer h-full"
>
<div className="pb-4">
<div
onClick={() => handleScheduleClick(schedule)}
className="flex items-stretch bg-white rounded-2xl shadow-sm hover:shadow-md transition-shadow overflow-hidden cursor-pointer h-[120px]"
>
{/* 날짜 영역 */}
<div
className="w-24 flex flex-col items-center justify-center text-white"
@ -924,6 +923,7 @@ function Schedule() {
);
})()}
</div>
</div>
</div>
</div>
);