Skip to content

Conversation

@namee-h
Copy link
Contributor

@namee-h namee-h commented Jun 28, 2025

개요

좋아요 삭제 후 상세페이지에선 좋아요가 남아있는 이슈

변경 사항

  • 새로운 기능 추가
  • 버그 수정
  • 리팩토링
  • 문서 수정

구현 내용

  • 좋아요 삭제 후 상세페이지에선 좋아요가 남아있는 이슈: 상세페이지와 동기화하기위해 삭제 후 쿼리키 호출
  • 기존에 유저프로필페이지에서 삭제핸들러함수로 사용
    • 페이지에서 useDeleteProjectsMutation 훅으로 분리

개발 후기 및 개선사항

이번 작업에서 배운 점

  • (없다면 패스)

어려웠던 점 / 에로사항

  • (없다면 패스)

다음에 개선하고 싶은 점

  • (없다면 패스)

팀원들과 공유하고 싶은 팁

  • (없다면 패스)

Copy link
Contributor

@tkyoun0421 tkyoun0421 left a comment

Choose a reason for hiding this comment

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

정말 고생 많으셨습니다 💯

Comment on lines +146 to +151
// 문서 ID를 직접 생성하여 삭제 (더 효율적)
const deletePromises = projectIds.map((projectId) => {
const likeId = `${userId}_${projectId}`;
return deleteDoc(doc(db, "likes", likeId));
});

Copy link
Contributor

Choose a reason for hiding this comment

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

오호.. 랜덤 ID가 아닌 부분이 이런 장점이 있었네여
firebase 또 쓸 일이 있다면 써먹을 수 있을 것 같네요 배워갑니다 💯

Comment on lines +103 to +115
const invalidateLikeQueries = async (): Promise<void> => {
const queries = [
[queryKeys.myLikedProjects, "details"],
[queryKeys.myLikedProjects, "ids"],
[queryKeys.projectLike],
[queryKeys.projectLikedUser],
[queryKeys.projects], // 홈페이지, 프로젝트 찾기 페이지 동기화
];

await Promise.all(
queries.map((queryKey) => queryClient.invalidateQueries({ queryKey }))
);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

비동기로 안 해도 될 것 같다는?? 🐌🐌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

호오 그러쿤욥 ! 사실 이 부분이 이전에 동기처리로 되어있었는데 너무 복잡해보여서 바꿨습니당..ㅎㅎ

Comment on lines +71 to +82
useEffect(() => {
if (appliedProjectsData) {
setAppliedProjects(appliedProjectsData);
}
}, [appliedProjectsData, setAppliedProjects]);

// 좋아요한 프로젝트 데이터를 store에 동기화
useEffect(() => {
if (myLikedProjectsData) {
setLikeProjects(myLikedProjectsData);
}
}, [myLikedProjectsData, setLikeProjects]);
Copy link
Contributor

Choose a reason for hiding this comment

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

요게 어떤 로직인지 궁금합니다! 데이터를 받아오면 store에 동기화 하는 코드일까여?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 지원한프로젝트랑 좋아요한프로젝트를 스토어에 동기화하는 코드에욥 !

Copy link
Contributor

Choose a reason for hiding this comment

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

그렇군여! 그럼 쿼리에서 관리하지 않으신가요??!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

쿼리에서 관리하고 있고, store는 전역 상태 동기화/빠른 접근을 위해 추가로 사용하는 보조 수단이에요!

@tkyoun0421 tkyoun0421 merged commit 9244cfa into amicable-development-center:develop Jun 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug 버그 수정 type: refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants