Skip to content

fix: 공고 수정시 발생한 버그에 따른 질문 key값 수정 #1031

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

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

lurgi
Copy link
Contributor

@lurgi lurgi commented Feb 17, 2025

작업 내용

  • 공고 수정시 발생한 버그에 따른 질문 key값 수정

@lurgi lurgi requested a review from llqqssttyy February 17, 2025 08:07
@lurgi lurgi self-assigned this Feb 17, 2025
@lurgi lurgi added the hotfix 기능 핫픽스. label Feb 17, 2025
Copy link
Contributor

1739779664.155759

@@ -49,20 +49,20 @@ function getQuestions(data: QuestionData[] | undefined): Question[] {
export default function useApplyManagement({ applyFormId }: UseApplyManagementProps): UseApplyManagementReturn {
const { data, isLoading } = applyQueries.useGetApplyForm({ applyFormId: applyFormId ?? '' });
const [applyState, setApplyState] = useState(getQuestions(data));
const [uniqueId, setUniqueId] = useState(DEFAULT_QUESTIONS.length);
const [uniqueId, setUniqueId] = useState(applyState[applyState.length - 1]?.id || DEFAULT_QUESTIONS.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

기존에 존재하던 질문이면 해당 아이디를 사용하고, 아니라면 length를 id로 만들게 되네요.
이렇게 되면 기존에 있던 질문의 id와 length가 일치할 경우 key 값이 중복되는 문제가 발생해요.ㅠㅠ
image

새롭게 생성된 질문의 id는 ${applyState[applyState.length-1]?.id}-added와 같이 특별한 문자열을 넣거나, 현재 시각의 밀리초를 해시값처럼 붙이는 방법을 사용해야 할 것 같습니다. 어떤 방법이 나을지 고민해 보시고 반영해주세요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

요고 id값에 1만 더해주면 될 것 같아 보이는데 어떻게 생각하세용? 증가값이라 중복 없을 것 같아요!

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 Author

Choose a reason for hiding this comment

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

아하 기존공고가 문제가되는군요! 수정했슴니당~

@lurgi lurgi requested a review from llqqssttyy February 17, 2025 11:03
Copy link
Contributor

@llqqssttyy llqqssttyy left a comment

Choose a reason for hiding this comment

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

굿굿

@lurgi lurgi merged commit dc00539 into fe/main Feb 17, 2025
24 of 25 checks passed
@lurgi lurgi deleted the fix-apply-key branch February 17, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix 기능 핫픽스.
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

2 participants