fix(outsourcing): 의뢰 폼 [다음] 무반응 — goNext 스테일 클로저 제거
useCallback deps([step])에 stepValid가 읽는 state가 없어 마운트 시점
빈 상태 기준으로 검증되던 회귀(b4f57c8) 수정. 일반 함수로 전환.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -122,11 +122,13 @@ export default function OutsourcingRequestForm() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const goNext = useCallback(() => {
|
// 주의: useCallback 금지 — stepValid가 매 렌더 갱신되는 state를 캡처하므로
|
||||||
|
// 메모이즈하면 스테일 클로저로 항상 초기(빈) 상태 기준 검증이 됨 (실제 운영 버그였음)
|
||||||
|
const goNext = () => {
|
||||||
if (!stepValid(step)) return;
|
if (!stepValid(step)) return;
|
||||||
setError('');
|
setError('');
|
||||||
setStep((s) => Math.min(s + 1, STEPS.length));
|
setStep((s) => Math.min(s + 1, STEPS.length));
|
||||||
}, [step]);
|
};
|
||||||
|
|
||||||
const goPrev = useCallback(() => {
|
const goPrev = useCallback(() => {
|
||||||
setError('');
|
setError('');
|
||||||
|
|||||||
Reference in New Issue
Block a user