fix: 가상 스크롤 버그 수정
- searchSchedules 미정의 오류 수정 (setSearchTerm만 사용) - Schedule.jsx 항목 간 여백 추가 (ITEM_HEIGHT 136px)
This commit is contained in:
parent
ad2d501c39
commit
043f8b465d
2 changed files with 7 additions and 18 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue