Skip to content

Commit

Permalink
🐛 fix: fix messages not refresh when creating a new topic (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Dec 28, 2023
1 parent a8daca5 commit 5e7985a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/store/chat/slices/topic/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export const chatTopic: StateCreator<
> = (set, get) => ({
// create
openNewTopicOrSaveTopic: async () => {
const { switchTopic, saveToTopic, activeTopicId } = get();
const { switchTopic, saveToTopic, refreshMessages, activeTopicId } = get();
const hasTopic = !!activeTopicId;

if (hasTopic) switchTopic();
else {
saveToTopic();
await saveToTopic();
refreshMessages();
}
},

Expand Down

0 comments on commit 5e7985a

Please sign in to comment.