[8주차/클레버] 워크북 제출합니다.#82
Open
kcleverp wants to merge 7 commits into
Open
Conversation
Author
|
미션 3빠르게 마무리하겠습니다 |
- 불필요 훅 정리 - blob 생성 로직 훅 분리(usePreviewUrl) - LpForm mutation & 모드 상태 훅 분리(useLpFormMutation & useLpModalController - 모달들의 공통 UI => Modal 컴포넌트로 분리 - 구조 변경점 layout 반영
- 미션 1 리팩토링 반영 - 디버깅 로그 삭제
- 미션 1 리팩토링 반영 - 디버깅 로그 삭제
bukyung03
reviewed
May 22, 2026
| isFetchingNextPage, | ||
| } = activeQuery; | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
현재 구조에서는 useEffect 내부에서 fetchNextPage()를 직접 호출하고 있는데 useThrottle의 비동기 타이머 주기와 리액트의 최신 렌더링 타이밍이 미세하게 어긋나면, 과거 주소의 함수를 참조하는 클로저 고임(Stale Closure) 현상이 일어나 무한 스크롤이 간혹 먹통이 될 위험이 있다고 합니다
최신 상태의 fetchNextPage를 볼 수 있도록 useRef 레퍼런스에 함수를 담아서 .current() 형태로 작성하면 어떨까요..?
const fetchNextPageRef = useRef(fetchNextPage);
fetchNextPageRef.current = fetchNextPage;
useEffect(() => {
if (throttledInView && hasNextPage && !isFetchingNextPage) {
fetchNextPageRef.current();
}
}, [throttledInView, hasNextPage, isFetchingNextPage]);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점