Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ refactor: Ensure Sequential Update and Refresh of Topics with Async Handling #2058

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/topic/client.ts
Expand Up @@ -40,7 +40,7 @@ export class TopicService {
return TopicModel.batchCreate(importTopics as any);
}

updateTitle(topicId: string, text: string) {
async updateTitle(topicId: string, text: string) {
return TopicModel.update(topicId, { title: text });
}

Expand Down
4 changes: 2 additions & 2 deletions src/store/chat/slices/topic/action.ts
Expand Up @@ -114,7 +114,8 @@ export const chatTopic: StateCreator<
updateTopicTitleInSummary(topicId, topic.title);
},
onFinish: async (text) => {
topicService.updateTitle(topicId, text);
await topicService.updateTitle(topicId, text);
await refreshTopic();
},
onLoadingChange: (loading) => {
updateTopicLoading(loading ? topicId : undefined);
Expand All @@ -126,7 +127,6 @@ export const chatTopic: StateCreator<
params: await chainSummaryTitle(messages),
trace: get().getCurrentTracePayload({ traceName: TraceNameMap.SummaryTopicTitle, topicId }),
});
await refreshTopic();
},
favoriteTopic: async (id, favState) => {
await topicService.updateFavorite(id, favState);
Expand Down