Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

팀원소개서 메인 페이지 초대 관련 기획 수정 #236

Merged
merged 9 commits into from
Mar 21, 2022
Merged

Conversation

100Gyeon
Copy link
Member

⛓ Related Issues

📋 작업 내용

  • 초대 수락/거절 버튼 눌렀을 때 뜨던 토스트 메시지 없애기
  • 초대 수락/거절 버튼 눌렀을 때 수락 완료/거절 완료 텍스트로 바뀌도록 구현

📌 PR Point

  • 버튼 누름 => 텍스트 보여줌 => 페이지 새로고침 순서로 작동합니다. (mock api 활용해서 확인했습니다.)
  • 간단한 수정사항 반영이라 바뀐 건 많이 없습니다 😅

👀 스크린샷 / GIF / 링크

팀초대

@100Gyeon 100Gyeon added the chore 🍣 기능 개발 외 부수적인 일들 label Mar 13, 2022
@100Gyeon 100Gyeon added this to the 3월 2주차 스프린트 milestone Mar 13, 2022
@100Gyeon 100Gyeon added this to In progress in 팀원소개서 via automation Mar 13, 2022
@100Gyeon 100Gyeon self-assigned this Mar 13, 2022
@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@100Gyeon 100Gyeon added this to In progress in 웹 칸반 보드 Mar 13, 2022
Copy link
Member

@SeojinSeojin SeojinSeojin left a comment

Choose a reason for hiding this comment

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

꼼꼼지연 수고 많았으~
api 추상화하는 과정이랑 리액트 쿼리 먹여주는 과정 해주면 좋을 것 같습니다!! 💖

@@ -12,12 +13,13 @@ interface TeamInvitationProps {
function TeamInvitation(props: TeamInvitationProps) {
const { id, name } = props;
const navigate = useNavigate();
const { fireToast } = useToast();
const [isAccepted, setIsAccepted] = useState(false);
const [isRejected, setIsRejected] = useState(false);

const onAcceptClick = async () => {
const response = await privateAPI.put({ url: `/team/invite/accept`, data: { teamId: id } });
Copy link
Member

Choose a reason for hiding this comment

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

요거 원래 api로 추상화 안하고 한방에 put 쏘는 방식이었구나..
혹시 TeamService에 추상화해줄 수 있을까..? acceptInvite랑 rejectInvite로!!
그리고 상태 코드를 컴포넌트에서 직접 보는 대신에 isSuccess라는 값만 와도 괜찮을 것 같아!!

그리고 accept한 다음에는 팀 목록에 갱신이 필요한데,
원래는 막 setTimeout 쓰고 navigate(0) 해서 새로고침 했지만,
리액트 쿼리를 도입한 지금은 invalidateQueries를 해주면 될 것 같아!!
invalidateQueries가 먹여지면 지금 있는 데이터들이 stale한(오래된) 값들이 되어서 다시 fetch하는 함수를 호출하게 되어!

즉, 팀 초대를 수락하면
=> 팀 수락 이전에 받은 데이터는 최신 값이 아니게 되고 (=stale해지고)
=> 이 사실을 리액트 쿼리한테 알려주면
=> 리액트 쿼리가 다시 데이터 받아오는 함수를 실행하는겨!!
=> 그러면 방금 가입한 팀을 볼 수 있는겨!

하지만 그걸 하려면 팀소서 메인에서도 리액트 쿼리를 먹여줘야 할 것 같다!!
만약 팀소서 메인에서 정보들 받아오는 쿼리를 짰다고 가정하고 그 쿼리 이름이 teamProfileList라고 가정하면
아래처럼 써주면 될거야!!

const queryClient = useQueryClient();

// 초대 승인 요청이 성공한 이후에
queryClient.invalidateQueries('teamProfileList');

참고자료 https://react-query.tanstack.com/guides/query-invalidation

Copy link
Member

Choose a reason for hiding this comment

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

새로고침 안하는게 좋을 것 같다고 생각했는데 이렇게 하면 되겠다!! 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

화면에 보이는 것만 생각하고 다했다고 pr 올린 걸 반성하게 되네 이렇게 자세하게 리뷰 달아주니 넘넘 고맙다 ㅠㅠㅠ
추상화랑 리액트 쿼리 시도해 볼게 !!

Copy link
Member Author

Choose a reason for hiding this comment

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

이 부분 수정해봤는데, 리뷰에서 언급한 의도대로 됐는지 한 번만 더 봐주시면 감사하겠습니당 👏

Copy link
Member

@NamJwong NamJwong left a comment

Choose a reason for hiding this comment

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

고생하셨오여 💓

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@100Gyeon 100Gyeon added the refactor 🪐 리팩토링 label Mar 19, 2022
@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@100Gyeon 100Gyeon merged commit b643b1d into dev Mar 21, 2022
팀원소개서 automation moved this from In progress to Done Mar 21, 2022
@100Gyeon 100Gyeon deleted the feat/#229 branch March 21, 2022 14:59
@100Gyeon 100Gyeon moved this from In progress to Done in 웹 칸반 보드 Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore 🍣 기능 개발 외 부수적인 일들 refactor 🪐 리팩토링
Development

Successfully merging this pull request may close these issues.

팀원소개서 메인 페이지 초대 관련 기획 수정
3 participants