숫자 칸에서 한 글자마다 커서가 풀리던 것 · 비율 상한 복구 - #298
Merged
Merged
Conversation
**① 커서가 풀렸다**
견적서 생성 팝업의 선수금 비율·금액 칸에서 한 글자 칠 때마다 포커스가 날아가
연속 입력이 안 됐다.
원인은 `Field` 를 **렌더 안에서 만든 것**이다:
Field={({ label, children }) => (...)}
React 는 컴포넌트 «타입»이 바뀌면 그 자리를 통째로 헐고 다시 짓는다. 렌더마다 새 함수는
새 타입이라, 안에 있던 `<input>` 이 사라졌다 새로 생겼다. 모듈 바깥으로 뺐다.
**② 전면 조사**
입력칸 51개가 있는 화면 전체를 훑었다 — 같은 부류(렌더 안 컴포넌트 선언, 값 기반 key)는
**이 한 곳뿐**이었다. 리스트의 `key={q.id}`·`key={o.value}` 는 안정적이라 무관하다.
**③ 비율 상한이 빠져 있었다**
예전 팝업의 `max={100}` 이 공용 조각으로 옮기면서 사라져 **2468% 가 그대로 먹혔다**
(선수금이 몫을 넘어 할부원금이 음수가 된다). 금액 칸과 같은 규칙으로 0~100 으로 누른다.
회귀 가드는 **화면 전체를 훑는다** — 이런 실수는 타입 오류도 콘솔 경고도 아니라
한 곳만 보게 두면 다음에 또 샌다.
Closes #297
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #297
① 커서가 풀렸다
Field를 렌더 안에서 만들고 있었다. React 는 컴포넌트 타입이 바뀌면 그 자리를 헐고 다시 짓는다 — 렌더마다 새 함수라<input>이 매번 새로 생겼다.② 전면 조사 결과
입력칸 51개가 있는 화면 전체(
.tsx전부)를 세 가지 기준으로 훑었다:key리스트의
key={q.id}·key={o.value}는 안정적인 식별자라 무관하다.③ 비율 상한이 빠져 있었다
예전 팝업의
max={100}이 공용 조각으로 옮기면서 사라졌다. 실제로 2468% 가 먹혔다 — 선수금이 나눠 가질 몫을 넘어 할부원금이 음수가 된다. 금액 칸과 같은 규칙으로 0~100 으로 누른다.확인한 것
진짜 컴포넌트를 띄워 사람이 치듯 한 글자씩 넣고 매 타에 포커스를 확인했다:
2→24→246→2468회귀 가드
화면 전체를 훑는다 — 이런 실수는 타입 오류도 콘솔 경고도 아니라, 한 곳만 보게 두면 다음에 또 샌다.
셋을 되살려 실제로 잡히는 것을 확인했다:
Field로 복귀「훑을 파일이 실제로 있다」는 검사도 넣었다 — 파일 수집이 깨지면 빈손으로 통과할 수 있다.
기존 실패 9건은 이 브랜치와 무관.