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

[QA] 혜택페이지 카테고리 클릭 이후 뒤로가기 동작 시 히스토리 남기는 기능 제거 #614

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

daepan
Copy link
Contributor

@daepan daepan commented Dec 26, 2024

  • Close #ISSUE_NUMBER

What is this PR? 🔍

  • 기능 : 혜택페이지 카테고리 클릭 이후 뒤로가기 동작 시 히스토리 남기는 기능 제거

Changes 📝

setParams 과정에서 replace 옵션 제어를 통해 에러를 수정했습니다.
그리고 또한 searchParams 훅에 대한 기능 수정을 통해 옵션이 리렌더링 과정에서의 호출을 줄이고, 기능 중 earchParams 객체는 React 상태와 동기화되지 않는 가변 객체인 문제로, 이를 직접 수정(delete 또는 set)한 뒤, 다시 setSearchParams를 호출해야 상태가 반영되도록 로직을 수정했습니다.

ScreenShot 📷

2024-12-26.6.15.20.mov

Test CheckList ✅

  • test 1
  • test 2
  • test 3

Precaution

✔️ Please check if the PR fulfills these requirements

  • It's submitted to the correct branch, not the develop branch unconditionally?
  • If on a hotfix branch, ensure it targets main?
  • There are no warning message when you run yarn lint

@daepan daepan self-assigned this Dec 26, 2024
@github-actions github-actions bot requested review from D0Dam and hoooooony December 26, 2024 09:16
Copy link
Contributor

@D0Dam D0Dam left a comment

Choose a reason for hiding this comment

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

핸드폰으로 휘뚜루 작성해서 리뷰가 구체적이지 못한점 죄송합니다😅 옵셔널하게 변경한거 좋네요! 기존 훅이 잘못된것 같은데 잘 변경해주신 것 같아요!

}
const { deleteBeforeParam = false, replacePage = false } = option;

const newSearchParams = new URLSearchParams(searchParams);
Copy link
Contributor

@D0Dam D0Dam Dec 26, 2024

Choose a reason for hiding this comment

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

새롭게 객체를 선언해서 써주고 있는데 set함수의 첫번째 인자로 그 전값을 가져와서 넣어줘도 되는 과정이 아닐까 하는데 어떻게 생각하나요? 혹은 새롭게 객체 선언을 했을때의 이점이 있을까요?

setSearchParams((prev) => ..., ...)
// 요런식으로 전값을 가져와서 고치기

Copy link
Contributor Author

Choose a reason for hiding this comment

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

searchParams를 트리거로 렌더링을 변화하는 경우가 있어 만약 해당 경우에 변경을 React에서 감지할 수 있도록 하기 위해서입니다.
React는 얕은 비교를 수행하기에 객체를 생성하여 하는 방식으로 사용했습니다.

@daepan daepan merged commit b142760 into develop Jan 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants