[FIX] 북마크 토글 API 중복 호출 방지#80
Merged
Merged
Conversation
minsoo0506
approved these changes
May 31, 2026
minsoo0506
left a comment
There was a problem hiding this comment.
확인했습니다! 별도 코멘트를 남길만한 부분은 없는 것 같습니다. 고생하셨습니다 :)
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.
Closes #57
개요
링크 카드의 북마크 버튼을 빠르게 여러 번 누를 때 같은 링크에 대한
PATCH /api/v1/saved-links/{id}/bookmark요청이 중복 호출되지 않도록 수정했습니다.기존에는
CardLink의useGuardedPress를 통해 짧은 시간 안의 연타는 일부 방지할 수 있었지만, 홈 화면과 저장 링크 전체보기에서는void handleBookmark(id)형태로 Promise가 전달되지 않아 API 요청이 700ms보다 오래 걸리는 경우 같은 링크에 대해 추가 토글 요청이 다시 발생할 수 있었습니다.또한 화면별로 북마크 호출 방식이 달라 홈 화면, 저장 링크 전체보기, 폴더 상세 화면의 동작이 완전히 일관되지 않았습니다.
따라서 이번 작업에서는 버튼 단위의 짧은 입력 방지가 아니라
toggleBookmarkcontext 레벨에서 링크 id별 요청 진행 상태를 관리하도록 변경했습니다. 같은 링크의 북마크 요청이 진행 중이면 추가 요청을 무시하고, 요청이 완료된 뒤 다시 누른 경우에만 새로운 토글 요청이 발생하도록 처리했습니다.주요 구현 내용
SavedLinksContext에bookmarkingLinkIds상태 추가toggleBookmark(id)내부에 링크 id별 in-flight guard 추가PATCH /bookmark요청이 나가지 않도록 처리bookmarkingLinkIds에 추가finally에서 해당 링크 id 제거CardLink에bookmarkDisabledprop 추가bookmarkingLinkIds.has(link.id)기준으로 북마크 버튼 비활성화void handleBookmark(id)호출을 Promise 반환 흐름으로 정리isBookmarked값만 rollbackNetwork request failed에러 메시지를 한글 안내 문구로 변환파일별 역할
context/saved-links-context.tsx: 북마크 요청 중인 링크 id 상태 관리, id별 중복 요청 방지, 실패 시 해당 링크만 rollback, 네트워크 실패 메시지 한글화components/ui/card-link.tsx: 북마크 버튼 전용 비활성화 prop 추가 및 요청 중인 북마크 아이콘 터치 차단app/(tabs)/(home)/index.tsx: 홈 화면 최근 저장 링크 북마크 버튼에 요청 중 상태 반영app/(tabs)/(home)/saved-links.tsx: 저장 링크 전체보기 북마크 버튼에 요청 중 상태 반영app/(tabs)/(folder)/[id].tsx: 폴더 상세 화면 북마크 버튼에 요청 중 상태 반영 및 실패 안내 처리해결한 이슈 목록
context/saved-links-context.tsx의toggleBookmark호출 흐름 확인PATCH /api/v1/saved-links/{id}/bookmark요청이 연속 터치 시 여러 번 발생할 수 있는 구조 확인체크 사항
참고사항
toggleBookmarkcontext 레벨에서 같은 링크 id의 중복 요청을 막는 방식입니다.Network request failed는네트워크 연결 상태를 확인한 뒤 다시 시도해주세요.로 표시되도록 변경했습니다.Screenshots or Video
-테스트를 위해 spring 서버를 일부러 껐습니다. 북마크가 일시적으로 비활성화 된 화면입니다.
