Skip to content

Commit

Permalink
fix: 멤버 추가 제대로 작동하지 않는 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Todari committed Sep 26, 2024
1 parent 57cb197 commit c94b5ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Design/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Input: React.FC<InputProps> = forwardRef<HTMLInputElement, InputPro
onChange,
onFocus,
onBlur,
inputType,
inputType = 'input',
isError,
placeholder,
autoFocus,
Expand Down
15 changes: 6 additions & 9 deletions client/src/hooks/useMembersStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,16 @@ const useMembersStep = ({billInfo, setBillInfo, currentMembers, setStep}: Props)
};

const handleNameInputEnter = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter' && canAddMembers) {
if (event.key === 'Enter' && canAddMembers && inputRef.current) {
event.preventDefault();
if (!billInfo.members.map(({name}) => name).includes(nameInput)) {
setBillInfoMemberWithId(nameInput);
}
setNameInput('');
if (inputRef.current) {
setNameInput('');
inputRef.current.value = '';
inputRef.current.blur();
setTimeout(() => {
inputRef.current?.focus();
}, 0);
}
if (event.nativeEvent.isComposing) {
return;
if (inputRef.current) inputRef.current?.focus();
}, 10);
}
}
};
Expand Down

0 comments on commit c94b5ca

Please sign in to comment.