[FEAT-3] 입력 form 미리보기 구현 #8
Open
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.
📑 개요
폼 입력 값에 대한 실시간 미리보기 기능을 구현합니다.
#3 [클라이언트 편의성 관련 기능을 추가합니다.]
🔑 주요 구현
🤔 고민했던 지점
엣지 케이스 최적화 여부:
디바운스에서 사용자가 값을 변경했다가 (예: "A" ➔ "B"), 타이머가 채 완료되기 전에 다시 원래 값("A")으로 되돌리는 상황을 고려했습니다.
고려한 방안:
이 경우, if (data === value)와 같은 비교 구문을 추가하면, data가 이미 "A"인 상태에서 불필요하게 setData("A")가 다시 호출되는 것을 막을 수 있었습니다.
최종 결정 (단순성 유지):
이 엣지 케이스로 인한 성능 영향이 미미하다고 판단했으며, 코드의 명확성과 단순성을 유지하기 위해 해당 최적화 로직은 제외하고 가장 기본적인 디바운스 형태로 구현을 완료했습니다.