Skip to content

Commit

Permalink
🐛 fix: fix toggle back to default topic when clearing topic
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Nov 5, 2023
1 parent 638e0bb commit 6fe0a5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/store/session/slices/chat/actions/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,16 @@ export const chatMessage: StateCreator<
ChatMessageAction
> = (set, get) => ({
clearMessage: () => {
const { dispatchMessage, activeTopicId, dispatchTopic } = get();
const { dispatchMessage, activeTopicId, dispatchTopic, toggleTopic } = get();

dispatchMessage({ topicId: activeTopicId, type: 'resetMessages' });

if (activeTopicId) {
dispatchTopic({ id: activeTopicId, type: 'deleteChatTopic' });
}

// after remove topic , go back to default topic
toggleTopic();
},

coreProcessMessage: async (messages, userMessageId) => {
Expand Down

0 comments on commit 6fe0a5c

Please sign in to comment.