Skip to content

Commit 74abc13

Browse files
committed
fix: clear form and attachment data explicitly when we click New Chat
1 parent 53c13e6 commit 74abc13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components/NewChatButton.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import React from 'react';
22
import { useFlow } from 'react-chatbotify';
3+
import { useFormContext } from '../contexts/FormContext';
34
import RefreshIcon from './icons/RefreshIcon';
45

56
const NewChatButton = () => {
67
const { restartFlow } = useFlow();
8+
const { resetTicketForm, resetFeedbackForm } = useFormContext();
79

810
const handleNewChat = () => {
11+
// Clear all form state to ensure a clean start
12+
resetTicketForm();
13+
resetFeedbackForm();
914
restartFlow();
1015
};
1116

0 commit comments

Comments
 (0)