[Fix] 중복 게시글 로드 현상 수정, 빠르게 스크롤을 내릴 시 중복요청 해결 #66
Closed
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.
📌 개요
👩💻 작업사항
할 때마다 마지막 게시글 보다 적은 _id 값을 가진 게시글을 로드하도록
수정
hasMorePosts 를 사용.(!loadPostsLoading && hasMorePosts)
pending 중에서는 loadPostsLoading = true이고
더 불러올 게시글이 있을 때는 전에 불러온 게시글이 꽉 차 있는
상태이므로 hasMorePosts = action.payload.length === 5 = true;
만일 더 불러올 게시글이 없는 경우에는 hasMorePosts =
action.payload.length < 5 = false 이거나
새로 불러온 게시글이 없으므로 로드 못함
중복 이벤트가 발생하기 때문에 쓰로틀링을 사용하여 처리
✅ 변경로직