Skip to content

Commit 762e1e4

Browse files
committed
[fix] input disabled 로직 수정
1 parent 67dac96 commit 762e1e4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/domains/recommend/components/ChatList.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@ function ChatList({
2626
const showProfile = !prevMsg || prevMsg.sender !== msg.sender;
2727

2828
if (msg.sender === 'USER') {
29-
return (
30-
<UserMessage
31-
key={`${msg.id}-${msg.sender}`}
32-
message={msg.message}
33-
showProfile={showProfile}
34-
/>
35-
);
29+
return <UserMessage key={keyId} message={msg.message} showProfile={showProfile} />;
3630
}
3731

3832
const isTyping = msg.type === 'TYPING';
3933

4034
return (
4135
<BotMessage
42-
key={`${keyId}-${msg.sender}`}
36+
key={keyId}
4337
messages={[
4438
{
4539
id: msg.id,

src/domains/recommend/components/ChatSection.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ function ChatSection() {
2121
const [messages, setMessages] = useState<ChatMessage[]>([]);
2222
const [userCurrentStep, setUserCurrentStep] = useState(0);
2323
const selectedOptions = useRef<{
24+
selectedSearchType?: string;
2425
selectedAlcoholStrength?: string;
2526
selectedAlcoholBaseType?: string;
2627
selectedCocktailType?: string;
2728
}>({});
2829

2930
const isInputDisabled =
30-
selectedOptions.current.selectedCocktailType !== 'QA' && userCurrentStep < 3;
31+
selectedOptions.current.selectedSearchType !== 'QA' && userCurrentStep < 3;
3132

3233
const handleSendMessage = async (payload: stepPayload | { message: string; userId: string }) => {
3334
const tempTypingId = `typing-${Date.now()}`;
@@ -118,6 +119,11 @@ function ChatSection() {
118119
const nextStep = value === 'QA' ? 0 : (stepData?.currentStep ?? 0) + 1;
119120
setUserCurrentStep(nextStep);
120121

122+
// 0단계에서 QA 선택 시
123+
if (stepData.currentStep === 0 && value === 'QA') {
124+
selectedOptions.current.selectedSearchType = 'QA';
125+
}
126+
121127
switch (stepData.currentStep + 1) {
122128
case 2:
123129
selectedOptions.current.selectedAlcoholStrength = value;

0 commit comments

Comments
 (0)