Skip to content

Conversation

@haegu97
Copy link
Contributor

@haegu97 haegu97 commented Jan 21, 2025

#️⃣연관된 이슈

#320

📝작업 내용

모임 검색 부분에 debounce 적용했습니다

@haegu97 haegu97 added ♻️ Refactor 코드 리팩토링 ✨ Feature 기능 개발 labels Jan 21, 2025
@haegu97 haegu97 self-assigned this Jan 21, 2025
@haegu97 haegu97 linked an issue Jan 21, 2025 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bookco ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 1:42am

Copy link
Contributor

@cloud0406 cloud0406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 내부에 메모리 누수 방지용 코드가 따로 없는 것 같아서 이 부분도 추가하면 좋을 것 같습니다!
수고하셨습니다~.~

function SearchInput({ value, onChange }: SearchInputProps) {
const [inputValue, setInputValue] = useState(value);

const debouncedOnChange = useMemo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p4: 여기 혹시 useMemo를 사용하신 이유가 있을까요? 이 부분은 useCallback이 어울리지 않을까 해서요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메모리 누수 방지용 코드에 대해서는 알아봐야 할 것 같아요!

useCallback 말고 useMemo를 사용한 이유는, 처음에는 useCallback으로 햇었는데 lint 에러가 발생하더라구요.

밑에 블로그 보고 해결했습니다.
내용은 "useCallback은 인라인 함수를 기대합니다. debounce나 throttle이 반환하는 함수를 전달하는 것은 적절하지 않습니다. 왜냐하면 ESLint 규칙이 어떤 의존성을 포함해야 하는지 정확히 파악할 수 없기 때문입니다. useMemo를 사용해서 해결해라"

참고 링크

Copy link
Contributor

@wynter24 wynter24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@haegu97 haegu97 merged commit f6f6c91 into develop Feb 7, 2025
7 of 8 checks passed
@haegu97 haegu97 deleted the 320-feature-모임-찾기-검색-debounce-적용 branch February 7, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발 ♻️ Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] 모임 찾기 검색 debounce 적용

4 participants